Thank you for the module.
If I understood correctly this makes it possible to submit POST requests with Feeds (in addition to default GET requests), and add parameters to it. The question is: which type of parameters and how to write them in the form?
Example, I need to execute a request like this:
curl -X POST 'https://website/api/' \
--header 'Content-Type: application/json' \
--header 'X-API-Key: my_key' \
--data-raw '{
"address": "my_address"
}'
and I tried to fill the Post parameters form both like this:
x-api-key: my_key
address: my_address
and like this:
--header: 'x-api-key: my_key'
--data-raw: '{
"address": "my_address"
}'
but I don't get anything back.
I tested with Postman and it works, so I guess while the module Feeds_Fetcher_Headers let us provide headers, what is this module providing?
Documentation is lacking
Thanks!
Comments
Comment #2
kopeboyOK I was looking into /vendor/guzzlehttp/guzzle/src/RequestOptions.php
and there I can see you basically are just adding a way to set the query parameters with this module (which we can usually also just add in the URL no?).. am I right?
So I guess I could edit the module to use the form for editing the HEADER and BODY Guzzle RequestOptions instead of the FORM_PARAMS right?
Thank you
Comment #3
sleitner commented@kopeboy with this module you can only add POST parameters (like your raw data) to the request, but no additional headers. Query parameters you can add by adding it to the URL.
If you want to modify the module for your needs, you have to add HEADERS and FORM_PARAMS arrays to the Guzzle request.
Comment #5
sleitner commented@kopeboy Please check out commit 25366c6f0bcac67426b3eb40b3dd89e8d7894738 in 1.0.x branch
Comment #6
kopeboyThank you for the quick response and commit, but
Shouldn't I be adding the BODY to the Guzzle request?!
It is just a single field of raw data (multiple lines allowed), not an array of query parameters (rows to preg_match) like the ones you can directly put in the url.
Here is what I have
Unfortunately it is returning:
and I don't understand why, since the same request is working in Postman and returning values :(
Comment #7
sleitner commented@kopeboy the EmptyFeedException is thrown in the fetcher as well as in the parser. Please check your parser settings, especially the mapping context (with the help of an evaluator e.g. https://jsonpath.com/). Test the parser with an uploaded json file.
Comment #8
sleitner commentedCheckout commit ac6e159fa408d4e9a269c6599d711be510b9cdba in 1.0.x branch. You can now choose between FORM_PARAMS and BODY guzzle request options
Comment #9
kopeboyWow, it works like a charm, THANK YOU!
How may I contribute back?
Comment #10
sleitner commentedThank you @kopeboy for making the module more versatile for everyone