How to send json data in GET request

Hello, I’m trying to integrate Odoo with an appgyver app but I have some troubles with Odoo Restful API cause require to send some json via body.

Somethig like this:

curl -X GET https://odoo-backend-url/api/product.product  \
       -H "Content-type: application/json" -H "Authorization: Token access_token_51307b968e963c74833691d881906b170f995b2b"  \
       -d "{\"domain\": \"[('name', 'ilike', 'sometext')]\",\"fields\": \"['list_of_fields']\"}"

The fill header is not a problem, in POST method there is not a problem to send json object with parameters but in GET I can’t send the data from AppGyver to API.

Thanks for the help.
j

Hi Jonathan,

a GET request with a body is outside the RFC spec:
As per RFC 7231:

GET is the primary mechanism of information retrieval and the focus of almost all performance optimizations.
A payload within a GET request message has no defined semantics; sending a payload body on a GET request might cause some existing implementations to reject the request.

Due to this, I assume its not supported in AppGyver.

Best,
Jo

You can use a HTTP Request flow function to attach a Body to a GET request

Thanks, yes I think is a no specification based implementation of Restful in Odoo.

Can you tell me more about this? or send me some documentation?

Thanks

Find HTTP Request flow function in the MarketPlace. Its just a logic node:
Capture

And you can see where you set it’s properties you can put anything you want in the GET Body:
Capture2

1 Like

Amazing @JOHN_WORSHAM this is just what I needed, with Rest API get the access token, then with HTTP request the other queries.

Thanks!

It doesn’t work because the RFC 7231, the body in GET request is ignored

Captura de pantalla de 2021-07-09 10-52-41

Must be required fix the Rest API in Odoo backend.