Hello!
I'm trying to change the refer in an order using the API sxapioeorderchange. I know I need to send the file twice. Once to get all the data and then another time with changes.
I'm able to do all of those things but not all at once.
- I trigger the API using a json file to get the data I need.
{
"request": {
"companyNumber": 1,
"operatorInit": "sys",
"operatorPassword": "",
"orderNumber": 74098390,
"orderSuffix": 1,
"includeLines": false,
"tInoeordheader": {
"t-inoeordheader": []
},
"tInoeordline": {
"t-inoeordline": []
},
"tInoeordlinecomp": {
"t-inoeordlinecomp": []
},
"tInoeordnotes": {
"t-inoeordnotes": []
},
"tInoeordhdrextra": {
"t-inoeordhdrextra": []
},
"tInoeordlineextra": {
"t-inoeordlineextra": []
}
}
}
- Here is the result.
{
"response": {
"cErrorMessage": "",
"tOutoeordheader": {
"t-outoeordheader": [
{
"addonamt1": 0.0,
"addonamt2": 0.0,
"addonamt3": 0.0,
"addonamt4": 0.0,
"addonamt5": 0.0,
"addonamt6": 0.0,
"addonamt7": 0.0,
"addonamt8": 0.0,
"addonno1": 1,
"addonno2": 2,
"addonno3": 0,
"addonno4": 0,
"addonno5": 0,
"addonno6": 0,
"addonno7": 0,
"addonno8": 0,
"addontype1": true,
"addontype2": true,
"addontype3": false,
"addontype4": false,
"addontype5": false,
"addontype6": false,
"addontype7": false,
"addontype8": false,
"apprinit": "",
"approvty": "Y",
"billdt": "2020-09-22",
"bofl": true,
"canceldt": null,
"codcollamt": 0.0,
"codfl": false,
"contactid": 0,
"countrycd": "CA",
"crreasonty": "",
"custpo": "camion neuf AL",
"datcoverfl": false,
"drexpfl": false,
"dwnpmtamt": 0.0,
"fpcustno": 0,
"inbndfrtfl": false,
"invno": 0,
"invsuf": 0,
"jobno": "",
"langcd": "F",
"lockfl": false,
"lostbusty": "",
"lumpbillamt": 0.0,
"lumpbillfl": false,
"lumppricefl": false,
"orderdisp": "",
"outbndfrtfl": false,
"pickcnt": 2,
"pickprtfl": true,
"placedby": "",
"pmfl": true,
"pricecd": 5,
"promisedt": "2020-09-22",
"proposalno": 0,
"prosno": 0,
"pstlicenseno": "",
"refer": "",
"reqshipdt": "2020-09-22",
"route": "BCE",
"shipinstr": "BCEE / BO DICOM/PURO PREDAID",
"shiptoaddr1": "3311 ADDR",
"shiptoaddr2": "",
"shiptoaddr3": "",
"shiptocity": "ST-GEORGES",
"shiptonm": SHIPTO NAME",
"shiptost": "QC",
"shiptozip": "G6A 0C6",
"shipviaty": "MK22",
"slsrepin": "cust",
"slsrepout": "94B",
"specdiscamt": 0.0,
"stagearea": "",
"storddays": 0,
"stordty": false,
"subfl": false,
"takenby": "cust",
"tendamt": 0.0,
"termspct": 2.0,
"termstype": "2-10",
"user1": "",
"user2": "",
"user3": "WEB305338",
"user4": "",
"user5": "y",
"user6": 0.0,
"user7": 0.0,
"user8": null,
"user9": null,
"usestepfl": false,
"vendrebamt": 0.0,
"wodiscamt": 0.0,
"wodiscpct": 0.0,
"wodisctype": false,
"filler1": "**taxflds**",
"citycd": "",
"countycd": "",
"statecd": "QC",
"other1cd": "",
"other2cd": "",
"nontaxtype": "",
"taxablefl": true,
"taxauth": "dom",
"taxdefltty": "s",
"taxovercd": "",
"taxoverfl": false,
"filler2": "**inqflds**",
"lastupdate": "09/30/20 0757 pv-are MD89",
"addondesc1": "CALL URGENCE",
"addondesc2": "FREIGHT OUT",
"addondesc3": "",
"addondesc4": "",
"addondesc5": "",
"addondesc6": "",
"addondesc7": "",
"addondesc8": "",
"addonnet1": 0.0,
"addonnet2": 0.0,
"addonnet3": 0.0,
"addonnet4": 0.0,
"addonnet5": 0.0,
"addonnet6": 0.0,
"addonnet7": 0.0,
"addonnet8": 0.0,
"actfreight": 0.0,
"boexistsfl": true,
"borelfl": false,
"bostage": 2,
"custno": 22675,
"contactnm": "",
"drdeldt": null,
"drdeltm": "",
"drholdfl": false,
"enterdt": "2020-09-22",
"invoicedt": "2020-09-22",
"jrnlno2": 2578109,
"linefl": false,
"nextlineno": 33,
"nodolines": 0,
"nolineitem": 32,
"nopackages": 6,
"orderdispword": "",
"paiddt": "2020-09-30",
"pickeddt": "2020-09-22",
"pickinit": "NA67",
"pkgid": "",
"shipdt": "2020-09-22",
"shipto": "00SM02",
"shipviatydesc": "MEKPRO 22",
"stagecd": 5,
"stagecdword": "Pd",
"termsdiscamt": 0.0,
"termstypedesc": "2% 10 MOIS S",
"taxamt1": 0.01,
"taxamt2": 0.0,
"taxamt3": 0.0,
"taxamt4": 0.0,
"totcost": 100.0,
"totcostord": 100.0,
"totcubes": 0.0,
"totinvamt": 100.0,
"totinvord": 100.0,
"totlineamt": 100.0,
"totlineord": 100.0,
"totqtyord": 100.0,
"totqtyshp":100.0,
"totweight": 100.0,
"transtype": "SO",
"wodiscoverfl": false,
"whse": "74",
"filler3": "**inqcustflds**",
"name": "CUSTOMER NAME",
"addr1": "3311 ADDR",
"addr2": "",
"addr3": "",
"city": "ST-GEORGES",
"state": "QC",
"zipcd": "G6A 0C6",
"phoneno": "9999999999",
"pocontctnm": "",
"pophoneno": "",
"soldtonm": "SOLDTONAME",
"soldtoaddr1": "3311 ADDR",
"soldtoaddr2": "",
"soldtoaddr3": "",
"soldtocity": "ST-GEORGES",
"soldtost": "QC",
"soldtozipcd": "G6A 0C6"
}
]
},
"tOutoeordline": {
"t-outoeordline": []
},
"tOutoeordlinecomp": {
"t-outoeordlinecomp": []
},
"tOutoeordnotes": {
"t-outoeordnotes": [
{
"pageno": 1,
"primarykey": "74098390",
"secondarykey": "",
"newrecordfl": false,
"newrecordglobalfl": false,
"deleterecordfl": false,
"changerecordfl": false,
"securefl": false,
"notedata": " info@macpek.com",
"printfl": false,
"printfl2": false,
"printfl3": false,
"printfl4": false,
"printfl5": false,
"requirefl": false
}
]
},
"tOutoeordhdrextra": {
"t-outoeordhdrextra": [
{
"fieldname": "dlvprintty",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user10",
"fieldvalue": " ",
"seqno": 0
},
{
"fieldname": "user11",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user12",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user13",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user14",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user15",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user16",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user17",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user18",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user19",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user20",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user21",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user22",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user23",
"fieldvalue": "",
"seqno": 0
},
{
"fieldname": "user24",
"fieldvalue": "",
"seqno": 0
}
]
},
"tOutoeordlineextra": {
"t-outoeordlineextra": []
},
"tMessages": {
"t-messages": []
}
}
}
- I have a script to make the changes I need. Once it’s done, I can paste it to the original file to send it again.
import json
my_dict = json.loads(json_input)
my_dict["response"]["tOutoeordheader"]["t-outoeordheader"][0]["refer"] = "G5FV"
json_output = json.dumps(my_dict,indent=4)
My problem is that in the response I get (point 2), I do not have the input (orderno and ordersuf). So even if my script gives me a result, I cannot use it to call the API again unless I paste it to the original file.
I tried with workflow and use the parameters. It works, but then I lose the ability to use my script to make changes before sending it back.
Is there a way to add the input to the response? Or is there a simpler way to do this?
Thank you!