Guida ai casi d'uso dell'API Token
Usa il Restricted Data Token per un accesso sicuro alle API dei partner di vendita.
Versione API: 2021-03-01
Cos'è l'API Token?
The Selling Partner API for Tokens (Tokens API) provides a secure way to access a customer's Personally Identifiable Information (PII). You can call the createRestrictedDataToken
operation of the Tokens API to get a Restricted Data Token (RDT) for one or more restricted resources that you specify. Or, if you have a delegatee application, you can get an RDT from a delegator application owned by a developer that you work closely with (refer to Delegating authorization). In either case, an RDT authorizes you to make calls to operations that return restricted data. For definitions, refer to Terminology.
When you call a restricted operation, you include an RDT in the x-amz-access-token
header. This is in contrast to other Selling Partner API operations, where you include an LWA access token in the x-amz-access-token
header. For more information, refer to Step 3. Add headers to the URI.
Delegare l'autorizzazione
With the Tokens API, a delegator application can get an RDT that delegates authorization to access PII to a delegatee application. The delegator application is authorized by the selling partner and is the application that the selling partner interacts with. The delegatee application performs a specialized function that requires PII, such as shipping, tax invoicing, or tax remittance services. These two applications are owned by different developers and are closely integrated, such that the delegator application can securely transmit an RDT to the delegatee application. For more information about delegating authorization using an RDT, refer to Tutorial: Delegate authorization to access PII.
Terminologia
-
Token di dati con restrizioni (RDT): un token di accesso di breve durata che autorizza le chiamate a operazioni limitate. Un RDT rimane valido per un'ora.
-
Restricted operation. An operation that returns restricted data, such as PII. You need an RDT to call a restricted operation.
-
Risorsa limitata: un metodo e un percorso HTTP che rappresentano un'operazione limitata.
-
Restricted report type. A report type that contains PII. Refer to Restricted report types.
-
Domanda di delegazione: un'applicazione che ottiene un RDT e lo passa a un'applicazione delegata. Il partner di vendita autorizza e interagisce con l'applicazione delegante.
-
Domanda del delegato: un'applicazione che ottiene l'autorizzazione a chiamare operazioni limitate da un RDT che le viene passato da un'applicazione delegante. Un'applicazione delegata svolge una funzione specializzata che richiede informazioni personali, ad esempio servizi di spedizione, fatturazione fiscale o versamento delle imposte e non è autorizzata direttamente dal partner di vendita.
-
Specific path. A path in a restricted resource that contains a specific order or shipment identifier. For example,
orders/v0/orders/902-3159896-1390916/address
. -
Generic path. A path in a restricted resource that contains a generic identifier, such as
{orderId}
or{shipmentId}
. For example,orders/v0/orders/{orderId}/address
.
Operazioni limitate
Le operazioni limitate restituiscono le informazioni di identificazione personale dei clienti. Hai bisogno di un RDT per chiamare un'operazione con restrizioni.
Ecco l'elenco delle operazioni limitate, raggruppate per API:
API Ordini con gestione logistica diretta:
getOrders
getOrder
API per ordini a evasione diretta v2021-12-28
getOrders
getOrder
API Spedizione con gestione logistica diretta:
getShippingLabel
getShippingLabels
getPackingSlip
getPackingSlips
getCustomerInvoice
getCustomerInvoices
createShippingLabels
API di spedizione ad adempimento diretto v2021-12-28
getShippingLabel
getCustomerInvoices
getCustomerInvoice
getPackingSlips
getPackingSlip
API Easy Ship v2022-03-23
createScheduledPackageBulk
API Gestito dal venditore:
getShipment
cancelShipment
cancelShipmentOld
createShipment
API Ordini:
getOrders
getOrder
getOrderItems
getOrderRegulatedInfo
getOrderAddress
getOrderBuyerInfo
getOrderItemsBuyerInfo
API Report:
getReportDocument
Note
- The
getReportDocument
operation is considered a restricted operation only when a restricted report type is specified. Refer to the list of restricted report types. - When calling the
createRestrictedDataToken
operation to get an RDT for thegetReportDocument
operation, the specified restricted resource can contain only a specific path, not a generic path. For definitions, refer to Terminology. - When using RDT to access the
getReportDocument
operation, make sure your application has the correct right roles to access the report. Refer to Roles in the Selling Partner API for roles to reports mapping.
Fatturazione della spedizione:
getShipmentDetails
API Spedizione:
getShipment
Tipi di report con restrizioni
I tipi di report con restrizioni contengono informazioni personali. Quando si specifica un tipo di report limitato in una chiamata all'operazione getReportDocument
, devi inviare un RDT con la chiamata.
Di seguito è riportato un elenco di tipi di report soggetti a restrizioni:
GET_AMAZON_FULFILLED_SHIPMENTS_DATA_INVOICING
GET_AMAZON_FULFILLED_SHIPMENTS_DATA_TAX
GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_SHIPPING
GET_FLAT_FILE_ORDER_REPORT_DATA_SHIPPING
GET_FLAT_FILE_ORDER_REPORT_DATA_INVOICING
GET_FLAT_FILE_ORDER_REPORT_DATA_TAX
GET_FLAT_FILE_ORDERS_RECONCILIATION_DATA_TAX
GET_FLAT_FILE_ORDERS_RECONCILIATION_DATA_INVOICING
GET_FLAT_FILE_ORDERS_RECONCILIATION_DATA_SHIPPING
GET_ORDER_REPORT_DATA_INVOICING
GET_ORDER_REPORT_DATA_TAX
GET_ORDER_REPORT_DATA_SHIPPING
GET_EASYSHIP_DOCUMENTS
GET_GST_MTR_B2B_CUSTOM
GET_VAT_TRANSACTION_DATA
SC_VAT_TAX_REPORT
Tutorial: Ottieni l'autorizzazione per accedere a tipi di report con restrizioni con informazioni PII
-
The
getReportDocument
operation is considered a restricted operation only when a restricted report type is specified. Refer to the list of restricted report types. -
When calling the
createRestrictedDataToken
operation to get an RDT for thegetReportDocument
operation, the specified restricted resource can contain only a specific path, not a generic path. For definitions, refer to Terminology.
Prerequisiti
Per completare questo tutorial, avrai bisogno di:
-
Authorization from the selling partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
Approvazione per i seguenti ruoli:
- Spedizione diretta al consumatore: necessaria per accedere alle informazioni sull'indirizzo di spedizione.
- Versamento delle imposte: necessaria per accedere alle informazioni sull'acquirente.
- Fatturazione fiscale: necessaria per accedere alle informazioni sull'acquirente.
To request access to these roles, refer to Registering as a developer and update your developer profile.
Passaggio 1. Ottieni un RDT
- Call the
createRestrictedDataToken
operation, passing the following parameters:
Parametro del corpo:
Parametro | Descrizione | Obbligatorio |
---|---|---|
restrictedResources | A list of restricted resources. Note: Growth in the number of restricted resources results in growth in the size of the resulting restricted data token. The maximum size of the restricted data token before encoding and encryption cannot exceed 7kb without risk of failure when the token is employed. When requesting multiple resources, make sure that the resources requested are valid for the selling partner account type. For example, if requesting an RDT token for a seller, do not include vendor specific APIs in the createRestrictedDataToken request call. Type: < RestrictedResource > array |
Esempio di richiesta
POST https://sellingpartnerapi-na.amazon.com/tokens/2021-03-01/restrictedDataToken
{
"restrictedResources": [
{
"method": "GET",
"path": "/reports/2021-06-30/documents/amzn1.spdoc.1.4.eu.dca0cb77-4733-4769-8476-f09bc32be2af.T1KIM200NIMFNU.1234"
}
]
}
Risposta
Una risposta con esito positivo include quanto segue:
Nome | Descrizione |
---|---|
restrictedDataToken | Un token di dati con restrizioni (RDT). Si tratta di un token di accesso di breve durata che autorizza le chiamate a operazioni limitate. Passa questo valore con x-amz-access-token intestazione quando si effettuano chiamate successive a queste risorse limitate. La dimensione dell'RDT è relativa al numero di risorse limitate specificate nella richiesta. La dimensione massima del token di dati con restrizioni prima della codifica e della crittografia non può superare i 7 kb senza rischio di errore quando il token viene utilizzato. Tipo: stringa |
expiresIn | La durata del Restricted Data Token, in secondi. Tipo: numero intero |
Esempio di risposta
{
"restrictedDataToken": "Atz.sprdt|IQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpSR",
"expiresIn": 3600
}
- Salva il
restrictedDataToken
valore (il RDT) da fornire nelgetReportDocument
operazione.
Tutorial: ottenere l'autorizzazione per accedere alle informazioni personali degli ordini all'ingrosso
You can get an RDT that provides authorization to access Personally Identifiable Information (PII) for bulk orders. The dataElements
values that you specify (using the restrictedResources
parameter of the createRestrictedDataToken
operation) determine the type of restricted data that the RDT authorizes your application to access. In this tutorial we request an RDT that authorizes access to both buyer information and shipping address information.
Prerequisiti
Per completare questo tutorial, avrai bisogno di:
-
Authorization from the selling partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
Approvazione per i seguenti ruoli:
- Spedizione diretta al consumatore: necessaria per accedere alle informazioni sull'indirizzo di spedizione.
- Versamento delle imposte: necessaria per accedere alle informazioni sull'acquirente.
- Fatturazione fiscale: necessaria per accedere alle informazioni sull'acquirente.
To request access to these roles, refer to Registering as a developer and update your developer profile.
Passaggio 1. Ottieni un RDT
Chiama l'operazionecreateRestrictedDataToken
per ottenere un RDT.
- Call the
createRestrictedDataToken
operation, passing the following parameters:
Parametro del corpo:
Parametro | Descrizione | Obbligatorio |
---|---|---|
restrictedResources
|
Un elenco di risorse con restrizioni. Nota:
Type: < |
Sì |
Esempio di richiesta
POST https://sellingpartnerapi-na.amazon.com/tokens/2021-03-01/restrictedDataToken
{
"restrictedResources": [
{
"method": "GET",
"path": "/orders/v0/orders",
"dataElements": ["buyerInfo", "shippingAddress"]
}
]
}
Risposta
Una risposta con esito positivo include quanto segue:
Nome | Descrizione |
---|---|
restrictedDataToken
|
Token di dati con restrizioni (RDT): si tratta di un token di accesso di breve durata che autorizza le chiamate a operazioni limitate. Passa questo valore con l'intestazione La dimensione dell'RDT è relativa al numero di risorse limitate specificate nella richiesta. La dimensione massima del token di dati con restrizioni prima della codifica e della crittografia non può superare i 7 kb senza rischio di errore quando il token viene utilizzato. Tipo: stringa |
expiresIn
|
La durata dell'RDT, in secondi. Tipo: intero |
Esempio di risposta
{
"restrictedDataToken": "Atz.sprdt|IQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpSR",
"expiresIn": 3600
}
- Save the
restrictedDataToken
value (the RDT) to use in Step 2. Include the RDT with a call to thegetOrders
operation
Passaggio 2. Includi l'RDT con una chiamata all'operazione getOrders
getOrders
Call the getOrders
operation of the Orders API, specifying the appropriate parameters to filter for the orders that you want. Be sure to include the RDT from Step 1. Get an RDT in the x-amz-access-token
header of your call to getOrders
. Because you specified both buyerInfo
and shippingAddress
in Step 1. Get an RDT, your call to getOrders
is authorized to return both buyer information and shipping address information for each order. Had you specified only buyerInfo
in Step 1, getOrders
would be authorized to return only buyer information for each order. Had you specified only shippingAddress
in Step 1, getOrders
would be authorized to return only shipping address information for each order.
Tutorial: ottenere l'autorizzazione ad accedere alle informazioni personali per gli articoli dell'ordine in un ordine
Puoi ottenere un RDT che fornisce l'autorizzazione ad accedere alle informazioni personali negli articoli dell'ordine in uno specificato. In questo flusso di lavoro specifici dataElements
=buyerInfo
per indicare che l'RDT autorizzerà la tua applicazione ad accedere alle informazioni sull'acquirente relative agli articoli dell'ordine.
Prerequisiti
Per completare questo tutorial, avrai bisogno di:
-
Authorization from the selling partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
Approvazione per i seguenti ruoli:
- Versamento delle imposte
- Fatturazione fiscale
Depending on your use case, you might need approval for only one of these roles. To learn more about roles and request access, refer to Registering as a developer and update your developer profile.
Passaggio 1. Ottieni un ID dell'ordine
Hai bisogno di un ID ordine per identificare un ordine per il quale desideri informazioni sull'articolo dell'ordine. Hai anche bisogno di un ID dell'ordine per ottenere un RDT che autorizzi l'applicazione ad accedere alle informazioni sull'acquirente relative agli articoli dell'ordine. Puoi utilizzare l'operazione getOrders
dell'API Ordini per ottenere un elenco di ordini, da cui puoi ottenere un ID dell'ordine che ti interessa.
-
Call the
getOrders
operation of the Orders API, specifying the appropriate parameters to filter for the order that you want.L'operazione restituisce gli ordini che corrispondono alla tua richiesta. Ogni ordine include un ID dell'ordine.
-
Tra gli ordini restituiti, identifica quello per il quale desideri informazioni sull'articolo dell'ordine.
-
Save the order ID for the order that you want, to use in Step 2. Get an RDT and Step 3. Include the RDT with a call to the
getOrderItems
operation.
Passaggio 2. Ottieni un RDT
Call the createRestrictedDataToken
operation to get an RDT. In the path
property of the restrictedResources
parameter, include the order ID from Step 1. Get an order ID. In this workflow we will specify the buyerInfo
value of the dataElements
parameter. This indicates that the RDT should provide authorization to access PII for use cases such as tax and gift wrapping.
Chiama l'operazionecreateRestrictedDataToken
per ottenere un RDT.
- Call the
createRestrictedDataToken
operation, passing the following parameter:
Parametro del corpo:
Parametro | Descrizione | Obbligatorio |
---|---|---|
restrictedResources
|
Un elenco di risorse con restrizioni. Nota:
Type: < |
Sì |
Esempio di richiesta
POST https://sellingpartnerapi-na.amazon.com/tokens/2021-03-01/restrictedDataToken
{
"restrictedResources": [
{
"method": "GET",
"path": "/orders/v0/orders/123-1234567-1234567/orderItems",
"dataElements": ["buyerInfo"]
}
]
}
Risposta
Una risposta con esito positivo include quanto segue:
Nome | Descrizione |
---|---|
restrictedDataToken
|
Token di dati con restrizioni (RDT): si tratta di un token di accesso di breve durata che autorizza le chiamate a operazioni limitate. Passa questo valore con l'intestazione La dimensione dell'RDT è relativa al numero di risorse limitate specificate nella richiesta. La dimensione massima del token di dati con restrizioni prima della codifica e della crittografia non può superare i 7 kb senza rischio di errore quando il token viene utilizzato. Tipo: stringa |
expiresIn
|
La durata dell'RDT, in secondi. Tipo: intero |
Esempio di risposta
{
"restrictedDataToken": "Atz.sprdt|IQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpSR",
"expiresIn": 3600
}
- Save the
restrictedDataToken
value (the RDT) to use in Step 3. Include the RDT with a call thegetOrder
operation.
Passaggio 3. Includi l'RDT con una chiamata all'operazione getOrderItems
getOrderItems
Call the getOrderItems
operation of the Orders API, specifying the order ID that you identified in Step 1. Get an order ID. Be sure to include the RDT from Step 1 in the x-amz-access-token
header of your call to getOrderItems
.
Tutorial: delegare l'autorizzazione ad accedere alle informazioni personali
Puoi delegare l'autorizzazione a chiamare operazioni limitate a un'"applicazione delegata", ovvero un'applicazione che svolge una funzione specializzata per un partner di vendita (ad esempio spedizione, fatturazione fiscale o servizi di versamento delle imposte) ma non è autorizzata direttamente dal partner di vendita. Puoi delegare l'autorizzazione in questo modo
- Calling the
createRestrictedDataToken
operation of the Tokens API (specifying the application ID of the delegatee application), - Ottenendo un RDT dalla risposta
createRestrictedDataToken
e - Trasmettendo l'RDT alla domanda del delegato.
The RDT authorizes the delegatee application to call restricted operations that return the PII required to perform functions on behalf of the selling partner. For definitions, refer to Terminology.
Prerequisiti
Per completare questo tutorial, avrai bisogno di:
-
Authorization from the selling partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
To have indicated in the App registration form that you want to delegate access to PII to another application. For instructions for updating the App registration form, refer to Registering your application. Indicate in the form the types of PII that you want to delegate.
-
L'ID dell'ordine per uno che richiede la funzionalità di spedizione o fiscale.
-
Una partnership con uno sviluppatore con un'applicazione delegata.
-
L'ID dell'applicazione della domanda del delegato.
-
Un mezzo sicuro per trasmettere un RDT e un ID dell'ordine a un'applicazione delegata.
In addition, the developer with the delegatee application in Step 3. The delegatee application calls the getOrder
operation will need to:
-
Register as a developer, requesting approval for the roles that are required to access buyer information and shipping address information. These are:
- Spedizione diretta al consumatore: necessaria per accedere alle informazioni sull'indirizzo di spedizione.
- Versamento delle imposte: necessaria per accedere alle informazioni sull'acquirente.
- Fatturazione fiscale: necessaria per accedere alle informazioni sull'acquirente.
For more information about roles, refer to Roles in the Selling Partner API.
Passaggio 1. Ottieni un RDT
Chiama l'operazione createRestrictedDataToken
per ottenere un RDT. Nella path
proprietà del parametro restrictedResources
, includi l'ID dell'ordine per il quale sono richieste le informazioni personali. In questo flusso di lavoro specificheremo sia i valori buyerInfo
che quelli shippingAddress
del parametro dataElements
. Ciò indica che l'RDT deve includere l'autorizzazione all'accesso alle informazioni personali per casi d'uso quali tasse e spedizione. Nel tuo flusso di lavoro puoi specificare un solo valore, a seconda delle informazioni personali richieste dallo stesso.
- Call the
createRestrictedDataToken
operation, passing the following parameters:
Parametri del corpo:
Parametro | Descrizione | Obbligatorio |
---|---|---|
restrictedResources
|
Un elenco di risorse con restrizioni. Nota:
Type: < |
Sì |
targetApplication
|
L'ID dell'applicazione di destinazione a cui viene delegato l'accesso. Tipo: stringa |
No |
Esempio di richiesta
POST https://sellingpartnerapi-na.amazon.com/tokens/2021-03-01/restrictedDataToken
{
"restrictedResources": [
{
"method": "GET",
"path": "/orders/v0/orders/123-1234567-1234567",
"dataElements": ["buyerInfo", "shippingAddress"]
}
],
"targetApplication": "amzn1.sellerapps.app.target-application"
}
Risposta
Una risposta con esito positivo include quanto segue:
Nome | Descrizione |
---|---|
restrictedDataToken
|
Token di dati con restrizioni (RDT): si tratta di un token di accesso di breve durata che autorizza le chiamate a operazioni limitate. Passa questo valore con l'intestazione La dimensione dell'RDT è relativa al numero di risorse limitate specificate nella richiesta. La dimensione massima del token di dati con restrizioni prima della codifica e della crittografia non può superare i 7 kb senza rischio di errore quando il token viene utilizzato. Tipo: stringa |
expiresIn
|
La durata dell'RDT, in secondi. Tipo: intero |
Esempio di risposta
{
"restrictedDataToken": "Atz.sprdt|IQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpSR",
"expiresIn": 3600
}
- Salva il valore
restrictedDataToken
(l'RDT) da fornire alla domanda del delegato nel passaggio successivo.
Passaggio 2.: trasmettere l'RDT e l'ID dell'ordine alla domanda del delegato
Trasmetti in modo sicuro l'RDT e l'ID dell'ordine all'applicazione del delegato. L'applicazione li utilizzerà quando chiamerà l'operazione getOrder
nel passaggio successivo.
Passaggio 3. L'applicazione del delegato chiama l'operazione getOrder
getOrder
The delegatee application calls the getOrder
operation of the Orders API, specifying in the path the order ID from Step 2. Pass the RDT and order ID to the delegatee application. The call must include the RDT (also from Step 2) in the x-amz-access-token
header of the call. Because both buyerInfo
and shippingAddress
were specified in Step 1. Get an RDT, the call to getOrder
returns both buyer information and shipping address information for the order.
- The delegatee application calls the
getOrder
operation, passing the following parameters:
Parametri del corpo:
Parametro | Descrizione | Obbligatorio |
---|---|---|
orderId
|
Un identificativo d'ordine definito da Amazon, nel formato 3-7-7. Tipo: stringa |
Sì |
Esempio di richiesta
GET https://sellingpartnerapi-na.amazon.com/orders/v0/orders/123-1234567-1234567
Risposta
Una risposta con esito positivo include quanto segue:
Nome | Descrizione |
---|---|
payload
|
Il payload per l'operazione Type: Order |
Esempio di risposta
{
"payload": {
"AmazonOrderId": "902-3159896-1390916",
"PurchaseDate": "2017-01-20T19:49:35Z",
"LastUpdateDate": "2017-01-20T19:49:35Z",
"OrderStatus": "Pending",
"FulfillmentChannel": "SellerFulfilled",
"NumberOfItemsShipped": 0,
"NumberOfItemsUnshipped": 0,
"PaymentMethod": "Other",
"PaymentMethodDetails": [
"CreditCard",
"GiftCerificate"
],
"MarketplaceId": "ATVPDKIKX0DER",
"ShipmentServiceLevelCategory": "Standard",
"OrderType": "StandardOrder",
"EarliestShipDate": "2017-01-20T19:51:16Z",
"LatestShipDate": "2017-01-25T19:49:35Z",
"IsBusinessOrder": false,
"IsPrime": false,
"IsGlobalExpressEnabled": false,
"IsPremiumOrder": false,
"IsSoldByAB": false,
"DefaultShipFromLocationAddress": {
"Name": "MFNIntegrationTestMerchant",
"AddressLine1": "2201 WESTLAKE AVE",
"City": "SEATTLE",
"StateOrRegion": "WA",
"PostalCode": "98121-2778",
"CountryCode": "US",
"Phone": "+1 480-386-0930 ext. 73824",
"AddressType": "Commercial"
},
"FulfillmentInstruction": {
"FulfillmentSupplySourceId": "sampleSupplySourceId"
},
"IsISPU": false,
"ShippingAddress": {
"Name": "Michigan address",
"AddressLine1": "1 Cross St.",
"City": "Canton",
"StateOrRegion": "MI",
"PostalCode": "48817",
"CountryCode": "US"
},
"BuyerInfo": {
"BuyerEmail": "user@example.com",
"BuyerName": "John Doe",
"BuyerTaxInfo": {
"CompanyLegalName": "A Company Name"
},
"PurchaseOrderNumber": "1234567890123"
}
}
}
- L'applicazione del delegato utilizza i dati nella risposta per eseguire le sue funzioni fiscali e di spedizione.
Tutorial: ottenere l'autorizzazione per accedere alle informazioni sulla spedizione per più spedizioni
Puoi richiedere un RDT che fornisca l'autorizzazione per ottenere informazioni sulla spedizione per qualsiasi spedizione di un partner di vendita.
Prerequisiti
Per completare questo tutorial, avrai bisogno di:
-
Authorization from the selling partner for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
Approval for the Direct-to-consumer shipping role, which is required to access shipping address information. To request access to this role, refer to Registering as a developer and update your developer profile.
-
Numero di spedizione per le spedizioni per le quali desideri ottenere informazioni sulla spedizione.
Passaggio 1. Ottieni un RDT
Call the createRestrictedDataToken
operation to get an RDT. In the path
property of the restrictedResources
parameter that you specify, use a generic path that includes this text: {shipmentId}
. For definitions, refer to Terminology.
- Call the
createRestrictedDataToken
operation, passing the following parameter:
Parametri del corpo:
Parametro | Descrizione | Obbligatorio |
---|---|---|
restrictedResources
|
Un elenco di risorse con restrizioni. Nota:
Type: < |
Sì |
Esempio di richiesta
POST https://sellingpartnerapi-na.amazon.com/tokens/2021-03-01/restrictedDataToken
{
"restrictedResources": [
{
"method": "GET",
"path": "/mfn/v0/shipments/{shipmentId}"
}
]
}
Risposta
Una risposta con esito positivo include quanto segue:
Nome | Descrizione |
---|---|
restrictedDataToken
|
Token di dati con restrizioni (RDT): si tratta di un token di accesso di breve durata che autorizza le chiamate a operazioni limitate. Passa questo valore con l'intestazione La dimensione dell'RDT è relativa al numero di risorse limitate specificate nella richiesta. La dimensione massima del token di dati con restrizioni prima della codifica e della crittografia non può superare i 7 kb senza rischio di errore quando il token viene utilizzato. Tipo: stringa |
expiresIn
|
La durata dell'RDT, in secondi. Tipo: intero |
Esempio di risposta
{
"restrictedDataToken": "Atz.sprdt|IQEBLjAsAhRmHjNgHpi0U-Dme37rR6CuUpSR",
"expiresIn": 3600
}
-
Save the
restrictedDataToken
value (the RDT) to use in Step 2. Include the RDT with a call thegetShipment
operation.For definitions, refer to Terminology.
Passaggio 2. Includi l'RDT con una chiamata all'operazione getShipment
getShipment
Call the getShipment
operation of the Merchant Fulfillment API, using the generic path that you specified in Step 1. Get an RDT and replacing {shipmentId}
with a real shipment ID from the selling partner. For example, GET /mfn/v0/shipments/FBA1234ABC5D
. Repeat this step for all of the shipments for which you want shipping information, specifying the appropriate shipment ID with each call. Each call must include the RDT from Step 1. Get an RDT in the x-amz-access-token
header.
Nota
An RDT remains valid for one hour.
Tutorial: Genera un SDK per l'API Tokens
Puoi trovare i passaggi che descrivono come generare un SDK per l'API Tokens in Java o C# nei seguenti passaggi:
- Genera un SDK Java con scambio di token LWA
- Creazione di un SDK C# con generazione e autenticazione di token LWA
If you're using the Java SDK, you should also:
-
Esegui
mvn package
all'interno della cartella SDK generata. -
Download any of the following files and use them to build classes inside the
main/java/sampleCode/
folder of the generated client library. For definitions, refer to Terminology.- RestrictedDataTokenWorkflow.java. For getting an RDT and using it to authorize your own application to call one or more restricted operations.
- DelegatedRestrictedDataTokenWorkflowForDelegator.java. For getting an RDT that delegates authorization to call restricted operations to a delegatee application.
- DelegatedRestrictedDataTokenWorkflowForDelegatee.java. For a delegatee application that receives an RDT from a delegator application and uses it for authorization to call restricted operations.
Usa l'ultima versione dell'API Tokens
Use the latest version of
tokens_2021-03-01.json
when generating your SDK to ensure that you are getting the latest functionality.
Updated 6 months ago