This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TI-API: Trying but failing to send a Testorder.

Part Number: TI-API

We are trying to send a testorder with the following JASON data:

{
"order": {
"checkoutProfileId": "<Checkout ProfileId replaced with this text",
"customerPurchaseOrderNumber": "1",
"endCustomerCompanyName": "1",
"customerOrderComments": [
{
"message": "1"
}
],
"lineItems": [
{
"customerLineItemNumber": 1,
"tiPartNumber": "NE555DR",
"customerPartNumber": "1",
"quantity": 1,
"customerItemComments": [
{
"message": "1"
}
]
}
]
}
}

But we keep getting the error:
{'errors': [{'section': 'Generic', 'errorType': 'BadRequest', 'errorCode': 'ERR-TICOM-ORDER-API-00400', 'reason': 'Invalid Syntax in request JSON', 'message': 'There is an error in the syntax. Please correct the syntax (i.e extra comma, missing comma, missing bracket, etc.) and try again.'}]}

What are we doing wrong?

Kind regards,

John Belmer

  • John,

    I was able to successfully generate a test order using your information and the exact payload that you included in this thread.   Can you send me your entire payload, including your URL endpoint?   If you are using an API development platform, can you confirm that you have unchecked everything on other tabs ("Headers" section or other sections)? I did not see your JSON payload come across.  I see "default" string parameters names (i.e. order=checkoutProfileID&order=cutomerPurchaseOrderNumber, etc...), which leads me to believe that there are other parameter fields that are marked and over-riding the JSON.   Can you confirm and let me know?

    Regards,

    Faye

  • Faye,

    Thank you for your reply, with the information you provided I found the problem: 

    Although I did state in the  header:

    {"accept": "application/json",
    "Authorization" : "Bearer "+ token,
    "Content-Type": "application/json"
    }

    The Python request-library did still not create a payload data in JSON format.

    Changing 

    data=payload_order

    to

     data=json.dumps(payload_order)

    fixed the problem. The JSON-Payload was correct, but the payload send by the request was not.

    Thank you for your help,

    kind regards,

    John Belmer

  • Glad you got it working!  Let me know if I can help further.

    Regards,

    Faye

**Attention** This is a public forum