概述

要开始使用 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 Keys and Access”页面上的“Request”。

 

第 2 步:订购流程概述

 

  1. 使用为您分配的 API 密钥进行身份验证
  2. 库存和价格 API 发送查询,检索产品供货情况和其他匹配信息。 
  3. API 将使用状态代码“200 OK”和包含申请的产品数据的 JavaScript 对象表示法 (JSON) 响应进行回复。
  4. 使用所需的有效载荷构建订单,并将其发布到订单 API
  5. API 将使用状态代码“200 OK”和包含订单确认的 JSON 进行回复。
  6. 查询订单 API,了解订单状态和其他订单详细信息。
  7. 订单处理后,通过出货前通知 (ASN) 检索 API 检索物流状态,通过财务单据检索 API 检索发票。
  8. 是否有兴趣查看这些步骤的示例代码? 下载我们的示例代码

 

 

第 3 步:身份验证

 

TI 已使用 OAuth 2.0 保护其 API 套件。使用您的 API 密钥进行身份验证。授权后,OAuth2 将返回与已启用的套件中的 API 一起使用的访问令牌。有关更多详细信息,请参阅“Authentication”页面。    

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 ("quantity": 5435);不过,在本示例中,数量限制为每个订单 50 ("limit": 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 Keys and Access”页面,了解有关公司帐户创建和结算信息的更多信息。要选择将随您的订单引用的结算信息,您需要从公司帐户中检索结算信息 ID。您可以在 myTI 帐户的“Order Preferences”>“Checkout Profiles”下找到结算信息。如下所示,在“Checkout Profiles”页面上,在 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™ 设计支持论坛发布您的问题