Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Amazon sales api gives me a regex error, when i'm literally copying the dates from the documentation

in SP-API /sales endpoing, i get a regex error trying to hit it for interval, even though i’m copying the data from amazons own documentation.

URL

https://sellingpartnerapi-na.amazon.com/sales/v1/orderMetrics?marketplaceIds=ATVPDKIKX0DER&interval=2019-08-01T00:00-07:00–2018-08-02T00:00-07:00

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

response:

{
    "errors": [
        {
            "code": "InvalidInput",
            "message": "{getOrderMetrics.arg1=must match \"[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{3})?(([+-]\\d\\d:\\d\\d)|Z)(\\[[a-zA-Z/_]+\\])?--[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{3})?(([+-]\\d\\d:\\d\\d)|Z)(\\[[a-zA-Z/_]+\\])?\"}",
            "details": ""
        }
    ]
}

Documentation

Example: 2018-09-01T00:00:00-07:00–2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone.

Tried above URL, was expecting some sort of a response.

>Solution :

Your URL time is missing seconds. A request with the parameter:

2019-08-01T00:00:00-07:00--2018-08-02T00:00:00-07:00

will work correctly. As you can see in the docs, there is a seconds field.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading