概覽

若要開始使用 TI store API 套件,請依照下列步驟執行: 

  1. 存取和開發的先決條件。 
  2. 使用 TI store API 套件檢閱一般訂購流程
  3. 驗證以接收存取權杖
  4. 了解如何查詢庫存和定價資訊
  5. 建立測試訂單
  6. 存取您的訂單資訊
  7. 了解如何擷取出貨追蹤
  8. 了解如何擷取發票
  9. 取得支援

 

步驟 1:先決條件

 

只有經核准的客戶才能使用 TI store API 套件建置應用程式。獲得核准:

  1. 建立 myTI 帳戶或登入您現有的 myTI 帳戶。
  2. 建立 myTI 公司帳戶
  3. 按一下 API 金鑰和存取頁面上的「索取」。

 

步驟 2:訂購流程概覽

 

  1. 使用您指定的 API 金鑰和秘密進行驗證
  2. 傳送庫存和定價 API 查詢,以擷取產品可用性和其他配對資訊。 
  3. API 將會回覆狀態代碼 200 OK 及包含索取之產品資料的 JavaScript Object Notation (JSON) 回應。
  4. 使用所需的酬載建立您的訂單,並將訂單發佈到訂單 API
  5. API 將會回覆狀態代碼 200 OK 及包含訂單確認的 JSON。
  6. 查詢訂單 API 以取得訂單狀態和其他訂單詳細資訊。
  7. 在處理訂單後,透過出貨前通知 (ASN) 擷取 API 擷取出貨追蹤,並且透過財務文件擷取 API 擷取發票。
  8. 有興趣查看每個步驟的範例程式碼嗎?下載我們的範例程式碼

 

 

步驟 3:驗證

 

TI 已使用 OAuth 2.0 確保其 API 套件的安全。使用您的 API 金鑰和秘密進行驗證。授權後,OAuth2 會傳回您已啟用之套件中 API 所使用的存取權杖。如需詳細資訊,請參閱驗證頁面。  

curl --request POST \   
       --url https://transact.ti.com/v1/oauth/accesstoken \   
       --header 'Content-Type: application/x-www-form-urlencoded' \   
       --data grant_type=client_credentials \   
       --data client_id=<<INSERT YOUR CLIENT KEY>> \   
       --data client_secret=<<INSERT YOUR SECRET>>

 

步驟 4:查詢庫存和定價

 

以下說明如何擷取每個產品的庫存可供應情況和定價資訊的範例,正在查詢零件編號 AFE7799IABJ。可供應庫存為 5,435 (「數量」:5435),但在此範例中數量限制為每筆訂單 50 (「限制值」:50) 個。如果產品沒有訂購限制、JSON 回應會在限制值欄位傳回空白值。如需與產品相關的所有參數的清單,請參閱庫存和定價 API

請求範例: 

curl --request GET \   
--url 'https://transact.ti.com/v2/store/products/AFE7799IABJ?currency=USD' \
--header 'Authorization: Bearer {access_token}' \

回應成功請求:

{
  "tiPartNumber": "AFE7799IABJ",
  "genericPartNumber": "AFE7799",
  "buyNowURL": "https://www.ti.com/product/AFE7799/part-details/AFE7799IABJ",
  "quantity": 5435,
  "limit": 50,
  "pricing": [
    {
      "currency": "USD",
      "priceBreaks": [
        {
          "priceBreakQuantity": 1,
          "price": 2.03
        },
        {
          "priceBreakQuantity": 10,
          "price": 1.43
        },
        {
          "priceBreakQuantity": 25,
          "price": 1.35
        },

...

  ],
  "description": "8-Bit 200MSPS Low-Power Analog-to-Digital Converter (ADC) With Internal Sample and Hold",
  "minimumOrderQuantity": 1,
  "standardPackQuantity": 126,
  "exportControlClassificationNumber": "EAR99",
  "htsCode": "8542390001",
  "pinCount": 5,
  "packageType": "SOT-23 (DBV)",
  "packageCarrier": "Large T&R",
  "customReel": true,
  "lifeCycle": "ACTIVE"
}

 

步驟 5:建立測試訂單

 

測試訂單為模擬性質,換句話說測試訂單不是提交的訂單,其作用僅為協助您開發應用程式。用於下測試訂單的庫存不會刪減或保留。傳回的資訊會模擬生產訂單資料傳回的資訊,但某些欄位僅用於示範目的,不代表已處理的資訊。

若要下單 (測試或生產),您必須在公司帳戶中儲存符合 API 資格的結帳設定檔。請參閱 API 金鑰和存取頁面,以進一步了解如何建立公司帳戶和結帳設定檔。若要選擇要參照您的訂單的結帳設定檔,您必須從公司帳戶擷取結帳設定檔 ID。您可以在 myTI 儀表板的「訂購偏好設定」>「結帳設定檔」下找到結帳設定檔。如下所示,在「結帳設定檔」頁面上,在您想要使用的結帳設定檔旁邊的 ID 欄中尋找複製圖示。

 

Checkout profiles table with ID column highlighted

複製您要用於訂單的 ID。

  "Orders" : {
    "checkoutProfileID" : "INSERT YOUR CHECKOUTPROFILEID HERE",
    "customerPurchaseOrderNumber" : "PGR - 04202021",
    "purchaseOrderDate" : "2020-12-31T13:56:00Z",
    "endCustomerCompanyName" : "TI Electronics Inc",
    "expediteShipping" : true,

使用產生的 checkoutProfileID,發佈您的訂單。

#!/bin/bash
curl --request POST \
--url 'https://transact.ti.com/v2/store/orders/test' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: application/json' \
--data-binary @- <<DATA
{
  "Orders" : {
    "checkoutProfileId" : "COP_ID-1234",
    "customerPurchaseOrderNumber" : "PGR - 04202021",
    "purchaseOrderDate" : "2020-12-31T13:56:00Z",
    "endCustomerCompanyName" : "TI Electronics Inc",
    "expediteShipping" : true,
    "orderComments" : [ {
      "attribute" : "PO: 234723"
    }, {
      "attribute" : "my Test order"
    } ],
    "lineItems" : [ {
      "customerLineItemNumber" : 1,
      "tiPartNumber" : "ISO1042",
      "customerPartNumber" : "CUS-SN74LS00N",
      "customReelIndicator" : false,
      "quantity" : 10000,
      "customerItemAttributes" : [ {
        "attribute" : "For BOM2  - aquired "
      } ]
    }, {
      "customerLineItemNumber" : 2,
      "tiPartNumber" : "OPA33AIDR",
      "quantity" : 10000
    } ]
  }
}
DATA

範例回應:

{
  "orderNumber": 0,
  "orderStatus": "string",
  "customerPurchaseOrderNumber": "string",
  "subTotal": 0,
  "totalPrice": 0,
  "lineItems": [
    {
      "tiPartNumber": "string",
      "tiPartDescription": "string",
      "quantity": "string",
      "status": "string",
      "unitPrice": 0,
      "customReelIndicator": true
    }
  ],
  "shippingAddress": [
    {
      "addressType": "string",
      "firstName": "string",
      "lastName": "string",
      "company": "string",
      "addressLine1": "string",
      "addressLine2": "string",
      "town": "string",
      "state": "string",
      "postalCode": "string",
      "country": "string",
      "email": "string",
      "phoneNumber": "string",
      "companyURL": "string"
    }
  ],
  "billingAddress": [
    {
      "addressType": "string",
      "firstName": "string",
      "lastName": "string",
      "company": "string",
      "addressLine1": "string",
      "addressLine2": "string",
      "town": "string",
      "state": "string",
      "postalCode": "string",
      "country": "string",
      "email": "string",
      "phoneNumber": "string",
      "companyURL": "string"
    }
  ],
  "orderMessages": [
    {
      "code": "string",
      "type": "string",
      "Message": "string"
    }
  ],
  "customerOrderAttributes": [
    {
      "attribute": "string"
    }
  ],
  "orderPlacedTime": "string",
  "paymentType": "string",
  "currencyISO": "string",
  "totalTax": 0,
  "checkoutProfileIdentifier": "string",
  "totalDeliveryCost": 0,
  "totalDiscount": 0,
  "couponCodes": "string"
}

準備下生產單時.請檢閱您要在要求酬載中傳送的所有參數,並使用 URL「.../store/orders」。若要進一步了解測試和生產訂購,請參閱訂單 API 文件頁面

 

步驟 6:查詢訂單詳細資料

 

若要進一步了解有關訂購和可用訂單的詳細資訊,請參閱訂單 API 文件頁面

請求範例:

curl --request GET \
--url 'https://transact.ti.com/v2/store/orders/{orderNumber}'
--header 'Authorization: Bearer {access_token}' \

範例回應:

{
  "orderNumber": 0,
  "orderStatus": "string",
  "customerPurchaseOrderNumber": "string",
  "subTotal": 0,
  "totalPrice": 0,
  "lineItems": [
    {
      "tiPartNumber": "string",
      "tiPartDescription": "string",
      "quantity": "string",
      "status": "string",
      "unitPrice": 0,
      "customReelIndicator": true
    }
  ],
  "shippingAddress": [
    {
      "addressType": "string",
      "firstName": "string",
      "lastName": "string",
      "company": "string",
      "addressLine1": "string",
      "addressLine2": "string",
      "town": "string",
      "state": "string",
      "postalCode": "string",
      "country": "string",
      "email": "string",
      "phoneNumber": "string",
      "companyURL": "string"
    }
  ],
  "billingAddress": [
    {
      "addressType": "string",
      "firstName": "string",
      "lastName": "string",
      "company": "string",
      "addressLine1": "string",
      "addressLine2": "string",
      "town": "string",
      "state": "string",
      "postalCode": "string",
      "country": "string",
      "email": "string",
      "phoneNumber": "string",
      "companyURL": "string"
    }
  ],
  "orderMessages": [
    {
      "code": "string",
      "type": "string",
      "Message": "string"
    }
  ],
  "customerOrderAttributes": [
    {
      "attribute": "string"
    }
  ],
  "orderPlacedTime": "string",
  "paymentType": "string",
  "currencyISO": "string",
  "totalTax": 0,
  "checkoutProfileIdentifier": "string",
  "totalDeliveryCost": 0,
  "totalDiscount": 0,
  "couponCodes": "string"
}

步驟 7:運送追蹤

 

在完成您訂單的包裝作業後準備運送時,TI 會產生可透過出貨前通知 (ASN) API 存取的運送追蹤資訊。此回應包含有關您的出貨詳細資訊,例如運送追蹤編號、貨運業者資訊和商業發票。API 可用於推播擷取實作。 

請求擷取範例:

curl --request GET \
--url 'https://transact.ti.com/v2/store/orders/{orderNumber}/advanced-shipment-notices/{wayBillNumber}'
--header 'Authorization: Bearer {access_token}' \

步驟 8:擷取發票

 

財務 API 提供非 Apruve 付款的發票資訊。若要使用財務 API 擷取發票.訂單編號是擷取之 JSON 酬載的必要部分。發票會在 TI 處理訂單後提供。

若發票使用 Apruve 作為付款方式,請瀏覽 Apruve 入口網站以直接取得發票。

若要擷取 PDF,請參見配置選項的文件。

請求範例:

curl --request GET \
--url 'https://transact.ti.com/v2/store/orders/{orderNumber}/financial-documents/{financialDocumentNumber}'
--header 'Authorization: Bearer {access_token}' \

範例回應:

{
    "OrderNumber": "T02281839",
    "SupplierFinancialDocumentIdentifier": "1234567890",
    "TotalNumberOfDocuments": "1",
    "Documents": [
        {
            "SupplierDocumentType": "INVOICE",
            "SupplierFinancialDocumentIdentifier": "1234567890",
            "SupplierDocumentCreatedDate": "2020-05-11",
            "SupplierDocumentStatus": "CLEARED",
            "SupplierDocumentCurrency": "USD",
            "CustomerPurchaseOrderIdentifier": "PO1234",
            "CustomerReferenceIdentifier": "0100000200",
            "SupplierGrossWeight": "100.000",
            "SupplierNetWeight": "100.000",
            "SupplierWeightUnit": "GRM",
            "SupplierCarrier": "FEDEX EXPRESS",
            "DocumentValue": {
                "SupplierTotalAmount": "15,000.00"
            },
            "SalesOrder": {
                "SupplierOrderIdentifier": "1000001234",
                "SupplierOrderLineItemNumber": "000000",
                "CustomerPurchaseOrderIdentifier": "PO1234",
                "CustomerPurchaseOrderDate": "2020-01-01"
            },
            "PaymentTerms": {
                "SupplierIncoterms1": "TERMS1",
                "SupplierIncoterms2": "TERMS2",
                "SupplierTermsOfDelivery": "SHIPPING TERMS",
                "SupplierTermsOfPayment": "Net XX Days from Invoice Date",
                "PaymentTermsText": [
                    {
                        "SupplierPaymentTermsText": "Up to XX.XX.2020 without deduction"
                    }
                ]
            },
            "CreditManager": {
                "SupplierCreditManagerName": "Bill Johnson",
                "SupplierCreditManagerTelephone": "1234567890",
                "SupplierCreditManagerEmail": "bj-noreply@ti.com"
            },
            "Delivery": {
                "SupplierDeliveryIdentifier": "0200000300",
                "SupplierDeliveryLineItemNumber": "000000",
                "SupplierDeliveryDate": "2020-04-13",
                "SupplierGoodsMovementDate": "2020-05-11"
            },
            "Waybill": {
                "SupplierWaybillNumber": "123456",
                "SupplierNumberOfBoxes": "1"
            },
            "Partners": [
                {
                    "PartnerTypeDescription": "Sender",
                    "Name1": "Texas Instruments Incorporated",
                    "Name2": "Semiconductor",
                    "StreetAddress": "12500 TI Boulevard",
                    "City": "Dallas",
                    "Region": "TX",
                    "PostalCode": "75243",
                    "Country": "US"
                },
...

 

步驟 9:何處可以找到技術支援

如需技術支援,請參閱 TI E2E™ 設計支援論壇發佈您的問題