Off topic - Curl experts
Graham White
Hi,
Are there any curl experts out there that can give me a bit of a lead on an issue I am having? I have to get some stuff out of gravity forms and I can use https://www.oursite.co.nz/wp-json/gf/v2/entries?search={"field_filters":[{"key":"date_created","value":"03/30/2021","operator":"is"}]} in Postman and it gives me all the entries for the 30th March which is great. When I try it from the command prompt using curl -k -X POST --header "Content-Type: application/json" --header "Authorization: Basic OURTOKEN " “https://www.eccreditcontrol.co.nz/wp-json/gf/v2/entries?search={"field_filters": [{"key":"date_created","value":"03/30/2021","operator":"is"}]}” I get globbing errors. I have replaced the last part with %7B%22field_filters%22%3A+%5B%7B%22key%22%3A%22date_created%22%2C%22value%22%3A%2203%2F30%2F2021%22%2C%22operator%22%3A%22is%22%7D%5D%7D to get the rid of the special characters which makes it work and I get a bunch of entries from the 11th April but I don’t get the entries for 30th march . Can anyone throw any light on my problem?
Regards
Graham White
IMPORTANT NOTICE: This e-mail message and any attachments are confidential to EC Credit Control and subject to legal privilege (which is not waived or lost by mistaken delivery). If you have received this e-mail in error, please advise the sender immediately and destroy the message and any attachments. If you are not the intended recipient you are notified that any use, distribution, amendment, copying or any action taken or omitted to be taken in reliance of this message or attachments is prohibited. EC Credit Control collects personal information to provide and market our services (see our privacy policy at: www.eccreditcontrol.co.nz – www.eccreditcontrol.com - www.eccreditcontrol.com.au for more information about use, disclosure and access). EC Credit Control’s liability in connection with transmitting, unauthorised access to, or viruses in this message and its attachments is limited to resupply of any affected message or attachments.
|
|
Tw point of attention:
1) Your enter key is broken... 2) Your date format is incorrect, see: - What is the "right" JSON date format? - Stack Overflow
|
|
Graham White
Hi,
Thanks for your reply. I am not sure what you mean by “your enter key is broken”? I have been struggling with this and can’t seem to get it to work no matter what format I have the date in. Below is the best I seem to get but it never gives me the data for March. I am a bit lost now and I hope you may be able to help.
curl -g -k -X POST --header "Content-Type: application/json" --header "Authorization: Basic OURKEY" https://www.OURWWW/wp-json/gf/v2/entries?search={%22field_filters%22:%20[{%22key%22:%22date_created%22,%22value%22:%2230/03/2021%22,%22operator%22:%22is%22}
Regards
Graham White
|
|
Joseph Feldman
Hi Graham, If you put the code in the command you have to put a backslash before each doublequote and bracket like this \{\"field_filters\":\[\{\"key\":\"date_created\",\"value\":\"03/30/2021\",\"operator\":\"is\"\}\]\}" or you can use the Curl command "--globoff " for the brackets. or you can have it in a file and use the @Filename. Regards, Joseph Feldman
On Tue, Apr 13, 2021 at 4:39 PM Graham White <graham.white@...> wrote: Hi,
|
|
Graham White
Hi,
Thanks everyone for you help. I have this now working. This is the correct format that works well. It gets all entries on the 30th March 2021. curl -g -k -X GET --header "Content-Type: application/json" --header "Authorization: Basic OURKEY" "https://www.OURSITE/wp-json/gf/v2/entries?search={%22field_filters%22:%20[{%22key%22:%22date_created%22,%22value%22:%2203/30/2021%22,%22operator%22:%22is%22}]}%0A" Regards Graham
|
|