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: Python, Order change Failed: 500

Part Number: TI-API

Hi TI support,

I am in Backlog Sandbox environment testing order change function.

However, there seems to be some steps (confirm the order?) that needs to be completed in your end so that I can send request to change existing order.
*ORDER NUMBER: TEST20231205155531

Here is my Python code for order_change:

from TI_Backlog_API_V2 import TI_Backlog_Orders

class Backlog_Example_Script:

    def __init__(self, client_id, client_secret, server, ship_to):
        self.server = server
        self.client_id = client_id
        self.client_secret = client_secret
        self.ship_to = ship_to
        self.ordersAPI = TI_Backlog_Orders(client_id=client_id, client_secret=client_secret, server=server)

    def change_order(self, customer_name, customer_order_number, line_items):
        response = self.ordersAPI.change_order(
            customer_name=customer_name,
            customer_order_number=customer_order_number,
            ship_to=self.ship_to,
            line_items=line_items
        )

        if response.status_code == 200:
            print("Order changed successfully.")
            return response.json()
        else:
            print(f"Failed to change order: {response.status_code}, {response.text}")
            return None

# Usage example
if __name__ == "__main__":
    client_id = 'masked'  # Replace with your actual client ID
    client_secret = 'masked'  # Replace with your actual client secret
    server = 'https://transact-pre.ti.com'  # Replace with the actual server URL
    shipTo='masked',
    soldTo='masked',
    debug=True,
    customer_name = 'Test Customer'  # Replace with the actual customer name
    customer_order_number = 'masked'  # Replace with the actual customer order number

    # Example line item changes
    line_items = [
        {
            "customerLineItemNumber": 1,
            "lineItemChangeIndicator": "U",
            "tiPartNumber": "SN74S00N",
            "customerAnticipatedUnitPrice": 0.8,
            "customerCurrencyCode": "USD",
            "schedules": [
                {
                    "requestedQuantity": 12000,
                    "requestedDeliveryDate": "2026-06-15"
                }
            ]
        }
    ]

    backlog_script = Backlog_Example_Script(client_id, client_secret, server, shipTo)
    result = backlog_script.change_order(customer_name, customer_order_number, line_items)

    if result:
        print("Updated Order Information:", result)
    else:
        print("Order update could not be processed.")

Here is the error message for order_change:

WARNING: Unexpected HTTP status code 500.
Failed to change order: 500, {
  "orders" : [
    {
      "messages" : [
        {
          "code" : "TI-SOU-50000",
          "type" : "ERROR",
          "message" : "System error occurred. Execution ID: execution-914c2838-2af5-47bb-ad61-b4a5ae195185-2023.12.06 . Contact TI API Support https://api-portal.ti.com/support with the execution ID."
        }
      ]
    }
  ]
}
Order update could not be processed.

Thanks,

David

  • Hi David, I see the order in our test system under the PO number you shared above. the value indicated in Order number is invalid for our system. You will get an assigned Order number at the time of order create when successful  (1021497291) this is your test order number connected to your PO number and the Order number cannot exceed 10 numeric digits.

  • Hi I tried with  "1021497291" as the PO number

    customer_order_number = '1021497291'
    but still receive error 500.
  • You cannot mix PO number and order number they are unique and different

    your PO number is your TEST20231205155531 value and the order number is the 1021497291 as order number 

    you must also send an order change indicator of U and you must input all values you used in the order and then only change date, qty, or price.

    sample modified json  --whatever you sent in the order  create must exact match except for what is changing.... price or qty or date. same material., same quantity, same PO  plus your credentials plus your access authentication token.


    "order": 
    "customerPurchaseOrderNumber": "TEST20231205155531",
    "shipToAccountNumber": "{{ _.shipto }}",
    "endCustomerCompanyName": "",
    "lineItems": [

    "customerLineItemNumber": "001",
    "lineItemChangeIndicator": "U",
    "tiPartNumber": "SN7407N",
    "customerPartNumber": "TILMNOP",
    "customerAnticipatedUnitPrice": 0.30,
    "customerCurrencyCode": "USD",
    "schedules": [

    "requestedQuantity": 2000,
    "requestedDeliveryDate": "2023-09-29"

    to authentiacate the call you have to also provide your credentials (key and secret plus your access token that must be refreshed every hour 

  • Will try that later.

    Do you have Order Management Documentation other than the API business guide book?

    Thanks,

    David

  • On our portal same area where you see the API business guidebook, click on the Order Management Suite API - Backlog API suite - Order management API | TI API Portal you will find the spec and their schema(s) are down below the API's - you can expand them to find fields, etc. this should be helpful to you.IS this what you are looking for?

  • Hi Tammy, what you mentioned is exactly what I am looking for. However, I still can't find where can user access the documentations.

    Documentation is not shown in the below link 'https://api-portal.ti.com/backlog-api-business-guidebook#push'

    And I've tried other ways to search, but no result at this moment.

      

    When I click the link in the bottom of the page to get to 'TI API Suite' I was able to find link to Backlog API suite but the site reject my visit.

    I was using the latest version of Chrome in Incognito mode and tried MS Edge (all cookie removed), but none of them worked. 

  • David with our most recently upgrade to a different software platform for our documentation we are having a few issues getting the access set for customers to see - if you use this link and you are a v2 customer you can access the data from this link until the portal issue is resolved. api-portal.ti.com/.../backlog-api-suite - you must be logged into your account. then you shoudl be able to see this similar view to get to the schemas. down below the APIs

**Attention** This is a public forum