Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In the Stripe API, how do you pass "optional dictionaries" endpoints specified as GET?

In the Stripe API reference, there are many cases like this where there's a "read" request that's specified as being submitted with GET, but have this to say about arguments:

created: A filter on the list based on the events created date. The value can be a string with an exact UTC timestamp, or it can be a dictionary with the following options: ...

What does this "optional dictionary" look like using curl? Does this mean that you use the -d command and POST, and submit the request to the same URI but with POST despite the API reference specifying GET?

Or does it mean that you're supposed to set dictionary attributes in the query string of the request... e.g. created[lt]=1521023230 encoded into the request URL as "https://api.stripe.com/v1/events?created%5Blt%5D=1521023230"...so you that it's still a GET request?

like image 610
Ascendant Avatar asked Sep 12 '25 16:09

Ascendant


1 Answers

With curl you can simply pass them as -d parameters. Here's an example

curl https://api.stripe.com/v1/charges?limit=3 \
   -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
   -d created[lte]=1517443200 \
   -G 
like image 171
koopajah Avatar answered Sep 16 '25 09:09

koopajah