Developer Console

Sample Queries

Create Data Query

Sample queries are provided using curl to enable flexibility over the client configuration. Assumption on configuration setup:

  • ACCESS_TOKEN - stores the LWA access token for the request.
  • API_ENDPOINT - stores the API endpoint selected by your Application.
  • SCOPE_ID - stores the Amazon Data Portability scope id for your request (example: portability-physical-orders)

Sample request:

curl --request POST 'https://$API_ENDPOINT/$SCOPE_ID/data-queries' -H 'authorization: Bearer $ACCESS_TOKEN' -l

Sample successful response:

{
   "id":"a1111111-b222-c333-d444-e55555555555"
}

Sample response with error:

{
  "category":"CONFLICT",
  "type":"REQUEST_CONFLICT",
  "message":"There is a conflicting request in progress"
}

List Data Query Records

Sample queries are provided using curl to enable flexibility over the client configuration. Assumption on configuration setup:

  • ACCESS_TOKEN - stores the LWA access token for the request.
  • API_ENDPOINT - stores the API endpoint selected by your Application.
  • SCOPE_ID - stores the Amazon Data Portability scope id for your request (example: portability-physical-orders).
  • QUERY_ID - stores the queryId of your request.
  • NEXT_PAGE_TOKEN - the value for the next page token.

Sample request: Default call, no parameters:

curl --request GET 'https://$API_ENDPOINT/$SCOPE_ID/data-queries/$QUERY_ID/records' -H 'authorization: Bearer $ACCESS_TOKEN' -l

Call with parameters:

  • using the maxResults and the nextPageToken parameters
curl --request GET 'https://$API_ENDPOINT/$SCOPE_ID/data-queries/$QUERY_ID/records' -H 'authorization: Bearer $ACCESS_TOKEN' -l -G -d 'maxResults=3' -d 'nextPageToken=$NEXT_PAGE_TOKEN'
  • with the maxResults parameter
curl --request GET 'https://$API_ENDPOINT/$SCOPE_ID/data-queries/$QUERY_ID/records' -H 'authorization: Bearer $ACCESS_TOKEN' -l -G -d 'maxResults=1'
  • with the nextPageToken parameter
curl --request GET 'https://$API_ENDPOINT/$SCOPE_ID/data-queries/$QUERY_ID/records' -H 'authorization: Bearer $ACCESS_TOKEN' -l  -G -d 'nextPageToken=$NEXT_PAGE_TOKEN'

Sample response without next page:

{
   "records":[
      {
         "schema":"schema_presigned_url_1",
         "file":"file_presigned_url_1"
      },
      {
         "schema":"schema_presigned_url_2",
         "file":"file_presigned_url_2"
      }
   ],
   "nextPageToken":""
}     

Sample response without next page result:

{
   "records":[],
   "nextPageToken":""
} 

Sample response with next page result:

{
   "records":[
      {
         "schema":"schema_presigned_url_1",
         "file":"file_presigned_url_1"
      },
      {
         "schema":"schema_presigned_url_2",
         "file":"file_presigned_url_2"
      }
   ],
   "nextPageToken":"token"
}     

Sample response with error:

{
  "category":"BAD_REQUEST",
  "type":"INVALID_MAX_RESULTS",
  "message":"Max results value is outside limits"
}

Response Notification

Completed Data Query:

{
    "Type": "Notification",
    "MessageId": "message-id",
    "TopicArn": "arn:aws:sns:region:account:topicId",
    "Subject": "Data Portability Notification 1.0",
    "Message": "{\"id\": \"dataQueryId1\",\"version\": \"1.0\",\"status\": \"COMPLETED\"}",
    "Timestamp": "2023-08-08T00:54:06.655Z",
    "Signature": "EXAMPLEw6JRN...", 
    "SigningCertURL": "<signature_cert_url>", 
    "UnsubscribeURL": "<unsubscribe_url>"
}

Canceled Data Query:

{
    "Type": "Notification",
    "MessageId": "message-id",
    "TopicArn": "arn:aws:sns:region:account:topicId",
    "Subject": "Data Portability Notification 1.0",
    "Message": "{\"id\": \"dataQueryId2\",\"version\": \"1.0\",\"status\": \"CANCELED\"}",
    "Timestamp": "2023-08-08T00:54:06.655Z",
    "Signature": "EXAMPLEw6JRN...", 
    "SigningCertURL": "<signature_cert_url>", 
    "UnsubscribeURL": "<unsubscribe_url>"
}

Last updated: Mar 07, 2024