Guia do sandbox dinâmico de envio direto do fornecedor
Use the Selling Partner API dynamic sandbox to test vendor direct fulfillment operations.
Visão geral
O ambiente de sandbox dinâmico da API do parceiro de vendas permite que você teste seus aplicativos sem afetar os dados de produção nem acionar eventos reais. O sandbox dinâmico encaminha as solicitações para um back-end de sandbox que pode retornar respostas realistas com base nos parâmetros da solicitação. Ao enviar solicitações para os endpoints do sandbox em vez dos endpoints de produção, você pode testar fluxos de trabalho padrão sem afetar os dados de produção.
This guide introduces the available dynamic sandbox operations for the Vendor Direct Fulfillment APIs. For more information about the Selling Partner API sandbox environments, refer to Selling Partner API sandbox.
Suporte dinâmico de sandbox nas APIs de envio direto do fornecedor
The following Vendor Direct Fulfillment API sections support the dynamic sandbox:
-
O Versão 2021-12-28 da API de pedidos de envio direto do fornecedor suporta todas as operações de produção equivalentes da V1.
Observação
Production calls for Vendor Direct Fulfillment Orders API include additional response parameters beyond
scenarioId
andorderId
sandbox parameters. You must update your request to specify these additional parameters prior to making production calls. -
O Versão 2021-12-28 da APIs de envio direto do fornecedor suporta todas as operações de produção equivalentes da V1.
Respostas estáticas
The dynamic sandbox backend service does not yet return dynamic responses for all Vendor Direct Fulfillment Shipping operations. The service returns static responses for the
submitShipmentStatusUpdates
,getCustomerInvoices
,getCustomerInvoice
,getPackageSlips
, andgetPackageSlip
operations. Any successful call to one of these operations always returns the same static response for that operation. -
O Versão 2021-12-28 da API de transações de envio direto do fornecedor suporta todas as operações de produção equivalentes da V1.
Use a Versão 2021-10-28 da API SandboxData do envio direto do fornecedor para gerar pedidos fictícios para usar durante os testes com essas APIs.
Teste usando as APIs de envio direto compatíveis
Follow these high-level steps to test using the supported Direct Fulfillment APIs:
-
Gere pedidos fictícios para testes. Os pedidos que você gera são projetados para acomodar os cenários específicos de teste de negócios descritos em Cenários.
-
Use the generated orders to perform business test scenarios with the supported Vendor Direct Fulfillment APIs and operations.
Importante
You must direct your sandbox requests to the Selling Partner API sandbox endpoints. If you are using a SP-API sandbox environment to test a call that requires a Restricted Data Token (RDT), you must get the RDT from the production environment and pass it to your sandbox call. For more information about restricted operations for which you need an RDT, refer to the Token API Use case guide.
Cenários
Os seguintes cenários de negócios são suportados nos pedidos gerados para fins de teste. Esses são os únicos casos de uso suportados pelos pedidos de teste e se concentram principalmente na geração de etiquetas para envio. Salvo indicação em contrário, os cenários de etiquetas retornam uma etiqueta fixa, padronizada e fictícia.
- LIFECYCLE: Use these test orders to simulate order lifecycle testing. The response to an operation that employs these orders can vary. For example, a ship label request made for a multi-box order results in a multiple label response. Similarly, a ship label request made with a package dimension change can result in a ship method change in the response.
- LABEL_CASE-SHIP_METHOD_UNASSIGNABLE: Use these test orders to simulate a ship method unassignable error, which occurs when Amazon is not able to assign a ship method for an order.
- LABEL_CASE-INCONSISTENT_METHODS: Use these test orders to simulate an "inconsistent ship method" error, which occurs when Amazon is not able to assign the same ship method to all of the boxes for a multi-box or multi-package order.
- LABEL_CASE-CARRIER_INTERNAL_FAILURE: Use these test orders to simulate a "carrier internal failure" error, which occurs when the carrier throws an error during label generation.
- LABEL_CASE-SYS_INTERNAL_FAILURE: Use these test orders to simulate a "system internal failure" error, which occurs when an unexpected failure happens in Amazon's systems.
- LABEL_CASE-DEST_ADDRESS_WRONG: Use these test orders to simulate a "destination address is wrong" error, which happens when a customer address falls outside of a carrier's service area.
- LABEL_CASE-SERVICE_NOT_AVAILABLE: Use these test cases to simulate a "service not available" error, which occurs when the selected carrier service is not available or applicable.
- SHIP_CONFIRM_CASE-SHIP_METHOD_UNASSIGNABLE: Use these test orders to simulate a ship method unassignable error, which occurs when Amazon is not able to assign a ship method for an order. This applies to vendor own label shipments.
- SHIP_CONFIRM_CASE-SYS_INTERNAL_FAILURE: Use these test orders to simulate a "system internal failure" error, which occurs when an unexpected failure happens in Amazon's systems.
ASINs de pedido de teste
Os pedidos fictícios gerados usam o conjunto de códigos ASIN de teste (números de identificação padrão da Amazon) e as características de pacotes associadas mostradas na tabela a seguir.
Tipo de pacote | ASIN | Características da embalagem |
---|---|---|
pacote pequeno | TESTASIN001 | Dimensões da embalagem (AxLxC): 2,54 cm x 2,24 cm x 5,08 cm (1 pol. x 1 pol. x 2 pol.) Peso: 453,59 g (1 lb.) |
pacote pequeno | TESTASIN004 | Dimensões da embalagem (AxLxC): 12,7 cm x 5,08 x 20,32 cm (5 pol. x 2 pol. x 8 pol.) Peso: 1,361 kg (3 libras). |
muito volumoso | TESTASIN002 | Dimensões da embalagem (AxLxC): 1,27 m x 1,27 m x 0,76 m (50 pol. x 50 pol. x 30 pol.) Peso: 45,36 kg (100 libras). |
várias peças | TESTASIN003 | Dimensões do pacote 1 (AxLxC): 91,44 cm x 93,98 cm x 60,96 cm (36 polegadas x 37 polegadas x 24 polegadas). Peso: 3,18 kg (7 libras). Dimensões do pacote: 2 (AxLxC): 25 cm x 76,2 cm x 101,26 cm (10 pol. x 30 pol. x 40 pol.) Peso: 1,360 kg (3 libras). |
Tutorial - Generate fictional orders for testing
Use this tutorial to generate test orders for the preceding scenarios to test the Vendor Direct Fulfillment APIs.
Follow these steps to generate test orders and related label scenarios:
-
Chame a operação
generateOrderScenarios
, especificando os identificadores de partes necessários.A Amazon recebe a solicitação de dados de teste. Se a operação for bem-sucedida, a resposta incluirá um valor
transactionId
. Ao receber uma resposta bem-sucedida, aguarde aproximadamente 30 a 40 minutos antes de continuar. -
Periodically call the
getOrderScenarios
operation, passing thetransactionId
value from the previous step, until you receive a successful response and thestatus
value in the response indicates that processing has ended. Processing ends when the status equalsSUCCESS
orFAILURE
. At this point the response includes either the test orders if the status isSUCCESS
, or an error array with details about the errors if the status isFAILURE
.
Pré-requisitos
Para concluir este tutorial, você precisará do seguinte:
- Autorização do parceiro de vendas para quem você está fazendo chamadas.
- Approval for the Direct-to-Consumer Shipping role in your developer profile.
- The Direct-to-Consumer Shipping role selected in the App registration page for your application.
Step 1: Request fictional test orders
Solicite os pedidos de teste fornecendo os identificadores de parte necessários. Para solicitar a geração de pedidos de teste, chame a operação generateOrderScenarios
, passando os seguintes parâmetros:
Parâmetros de solicitação
Corpo da solicitação
Parâmetro | Descrição | Obrigatório |
---|---|---|
orders |
Uma matriz de pedidos de teste, conforme indicado pelos identificadores das partes. Tipo: < OrderScenarioRequest > matriz |
Sim |
Exemplo de solicitação
POST http://sandbox.sellingpartnerapi-na.amazon.com//vendor/directFulfillment/
sandbox/2021-10-28/orders
{
"orders": [
{
"sellingParty": {
"partyId": "NIQQM"
},
"shipFromParty": {
"partyId": "CWPQ"
}
}
]
}
Resposta
Uma resposta bem-sucedida inclui o seguinte:
Parâmetro | Descrição | Obrigatório |
---|---|---|
transactionId |
Um GUID atribuído pela Amazon para identificar essa transação. Tipo: string |
Sim |
Exemplo de resposta
{
"transactionId": "0343fcb3-fd7e-455e-968f-fb4ff7dd4081-20211014222021"
}
Depois de receber uma resposta bem-sucedida com o transactionID, aguarde aproximadamente 30 a 40 minutos antes de prosseguir para a Etapa 2.
Step 2: Return the status and the requested fictional orders if ready
To retrieve the status of the generateOrderScenarios
transaction, and the requested test order data if available, call the getOrderScenarios
operation and pass the required transactionId
parameter. You must call this operation periodically until you receive either a successful response that contains the generated test orders, or a failure response that contains an error array with details about the errors.
After you receive the test orders, use them to perform dynamic ship label testing with the supported Vendor Direct Fulfillment APIs and operations.
Parâmetros de solicitação
Parâmetro do caminho
Parâmetro | Descrição | Obrigatório |
---|---|---|
transactionId |
O identificador da transação retornado na resposta à operação generateOrderScenarios. | Sim |
Exemplo de solicitação
GET http://sandbox.sellingpartnerapi-na.amazon.com/vendor/directFulfillment/
sandbox/2021-10-28/transactions/0343fcb3-fd7e-455e-968f-fb4ff7dd4081-20211014222021
Resposta
Uma resposta bem-sucedida inclui o seguinte:
Parâmetro | Descrição | Obrigatório |
---|---|---|
transactionStatus |
Os detalhes da transação, incluindo o status. Se a transação foi bem-sucedida, também inclui os dados solicitados da ordem de teste. Tipo: Transação |
Sim |
Exemplo de resposta
Sucesso (código de status HTTP 200) - A resposta contém os dados de teste do cenário gerados com números de pedidos
{
"transactionStatus":
{
"transactionId": "ff35f39e-e69f-499e-903e-6c4f6c32609f-20210827003315",
"status": "Success",
"testCaseData":
{
"scenarios": [
{
"scenarioId": "LIFECYCLE",
"orders": [
{
"orderId": "T1111N"
},
{
"orderId": "T1111P"
}
]
},
{
"scenarioId": "LABEL_CASE-SHIP_METHOD_UNASSIGNABLE",
"orders": [
{
"orderId": "T5555N"
},
{
"orderId": "T5555P"
}
]
},
{
"scenarioId": "LABEL_CASE-INCONSISTENT_METHODS",
"orders": [
{
"orderId": "T2222N"
},
{
"orderId": "T2222P"
}
]
},
{
"scenarioId": "LABEL_CASE-CARRIER_INTERNAL_FAILURE",
"orders": [
{
"orderId": "T3333N"
},
{
"orderId": "T3333P"
}
]
},
{
"scenarioId": "LABEL_CASE-SYS_INTERNAL_FAILURE",
"orders": [
{
"orderId": "T4444N"
},
{
"orderId": "T4444P"
}
]
},
{
"scenarioId": "SHIP_CONFIRM_CASE-SHIP_METHOD_UNASSIGNABLE",
"orders": [
{
"orderId": "buw38"
}
]
},
{
"scenarioId": "SHIP_CONFIRM_CASE-SYS_INTERNAL_FAILURE",
"orders": [
{
"orderId": "qqw52"
}
]
},
{
"scenarioId": "LABEL_CASE-DEST_ADDRESS_WRONG",
"orders": [
{
"orderId": "T6666N"
},
{
"orderId": "T6666P"
}
]
},
{
"scenarioId": "LABEL_CASE-SERVICE_NOT_AVAILABLE",
"orders": [
{
"orderId": "T7777N"
},
{
"orderId": "T7777P"
}
]
}
]
}
}
}
Exemplo de resposta
Processamento (código de status HTTP 404) - A solicitação está sendo processada e a geração dos dados de teste ainda não foi concluída.
{
"errors": [
{
"code": "ResourceNotFound",
"message": "Cannot find resource by the given URI"
}
]
}
Exemplo de resposta
Failure (HTTP status code 200) - The test data failed to generate. Refer to the errors array for more information.
{
"transactionStatus":
{
"transactionId": "ee8363d3-d061-4b17-b218-d3c80e014c2f-20220105231359",
"status": "FAILED",
"testCaseData":
{
"scenarios": [
{
"scenarioId": "",
"orders": []
}
]
},
"errors": [
{
"code": "INVALID_WAREHOUSE_CODE",
"details": "Invalid Warehouse Code. Retry request with correct Warehouse code"
}
]
}
}
Updated 20 days ago