Developer Console

Catalog API Solution Overview

Overview

This is a sample solution providing Just Walk Out customers with a sample implementation to interact with the Catalog API

Setup

  • Create S3 bucket for Lambda layer called my-urllib3-layer-bucket. This allows the lambda functions below to execute correctly. For steps on how to create an S3 follow AWS best practices here

  • The solution sample depends on using urllib3 to invoke APIs and therefore you will need to create a lambda layer to enable the solution to work as expected. Follow these steps to build a lambda layer

Step 1 - Create a local directory for the layer content:

mkdir -p python/lib/python3.x/site-packages

Step 2 - Replace 3.x with the Python version of your Lambda runtime (e.g., 3.9, 3.11). Install urllib3 into the layer directory.

pip install urllib3 -t python/lib/python3.x/site-packages/

Step 3 - Ensure 3.x matches your Lambda runtime. If you need a specific version of urllib3 (e.g., for compatibility with older Python runtimes or OpenSSL versions), specify it:

pip install "urllib3<1.27" -t python/lib/python3.x/site-packages/

Step 4 - Create a zip archive of the layer content:

zip -r urllib3_layer.zip python/

  • Upload lambda layer file to the S3 bucket

  • Upload sample report file sample_report.json store here This file is needed for testing later in the process

Deployment

  • Run the SQSSetupTemplate to create the SQS and resources needed for the catalog API to function as expected

Note: The template requires the SNS topic ARN. Please work with your Amazon team contact to get the SNS topic ARN.

  • Login to the the Amazon Just Walk Out merchant portal to beging the onboarding porocess. You can follow the steps for onboarding here

At this point you have completed the authorization to allow your AWS account to call the Catalog API. For the Catalog API invocation URL please work with your Amazon team to get the correct endpoint. For any issues you face during the onboarding process please see the FAQ page here

  • Log into the AWS console and run the SubscriptionConfirmationLambda to confirm the SNS to SQS subscription. This will complete the SNS subscription to allow the Amazon systems to publish Catalog API upload results to your AWS account. Note that Lambda function does not take any input
  • Run the subscription lambda by executing the test function in the lambda function without any change to the inputs or do a manual subscription confirmation

  • You can refresh the status in the merchant portal to confirm the subscription is all set

Now that the setup is completed you can invoke the catalog API. You can use the provided

  • Run the connectivity test lambda created in the previous step. The lambda function takes input for the stores you plan to use the catalog for. You can get the store list by navigating to in the Catalog API setup in the Amazon merchant portal. Sample payload below
{
  "storeList": [
    "<STORE ID HERE>",
    "<STORE ID HERE>"
  ]
}

Note: when successful this completes the customer onboarding and now we move into building the integration and testing

  • Run the Invoke_catalog_api template, this will build a lambda that allows you to test the catalog API with a test payload
  • The template requires the URL for the invoke API, please work with your Amazon team contact to get the correct invoke URL

Note: make sure to match the environment for the URLs

  • Run the process_catalog_message template found here

At this point you will have deployed all the resources necessary to run the solution end to end. Final step is to connect the SQS to use the lambda deployed in the process_catalog_message template. For steps on how to setup the trigger, follow the steps here

Note: This sets up the process where a catalog upload is processed by Amazon and a message is sent from Amazon to your SQS. The Lambda will wake up and proces the SNS message, sample can be found in here

Testing

  • You can invoke a catalog upload call and confirm that the results file is stored in the destination bucket. To do that follow these steps

  • Go to the lambda created in invoke_catalog_api.yaml and modify the payload for the catalog API. You will need to change the value for "store_id": "", to match your store id. The value for the store id is available in the catalog API UI

  • Execute the lambda by hitting test

  • If you receive a 201 then you should receive a results file in the destination bucket created in process_catalog_message template once the upload is completed