Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

querying /orders/search endpoint through always an error #143

Open
zaidoun-flaconi opened this issue Jul 7, 2023 · 0 comments
Open

querying /orders/search endpoint through always an error #143

zaidoun-flaconi opened this issue Jul 7, 2023 · 0 comments
Labels
triage Needs triage

Comments

@zaidoun-flaconi
Copy link

I'm trying to query https://docs.commercetools.com/api/projects/order-search#search-orders endpoint by calling:

range_query = {
    "query" : {
    "and": [
        {
            "range": {
                "field": "createdAt",
                "gte": "2023-05-31T23:00:00.000Z"
            }
        },
        {
            "exact": {
                "field": "store.key",
                "value": "at"
            }
        }
    ]
},
    "sort" : None,
    "limit" : 10,
    "offset": 10
}

orderSearchRequest = OrderSearchRequest("query"=range_query)
ctClient = client.with_project_key("prod").orders().search().post(body=orderSearchRequest}))

The root cause is the deserialize of orderSearchRequest in the post request body results in a empty dict which results in '400' error code CT response with following message
b'{"code":400,"errors":["Invalid JSON at '.query': Exactly one [fullText], [exact], [prefix], [wildcard], [range] or [exists] expression needed."]}'

could you please assists what is missing here?
thanks

@demeyerthom demeyerthom added the triage Needs triage label Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs triage
Projects
None yet
Development

No branches or pull requests

2 participants