Fetch Bins API
Using the Fetch Bins API, you could retrieve the records in your Collection by sorting them in an Ascending or Descending order.
This API will only return you the Meta Data of the bins like Bin Id, Created At Timestamp, Private/Public bin etc.
Root
https://api.jsonbin.io/v3
Route
To Fetch the First 10 Bins
/c/<COLLECTION_ID>/bins
To Fetch the rest of the Bins, pass the Last Bin Id you've fetched from the previous GET and pass it in the below URL
/c/<COLLECTION_ID>/bins/<LAST_BIN_ID>
Request Type
GET
Request Headers
Below are the list of Accepted Request Headers if you are trying to Attach a Schema Doc to a Collection.
Request Header | Value | Required |
---|---|---|
X-Master-Key | <API_KEY> | Yes |
X-Sort-Order | <ascending/descending> | No |
X-Master-Key Required
X-Master-Key is nothing but your Core API Access Key. You will need this Key to access mostly any API end-point on JSONBin. You could find the key on the API Keys page.
X-Sort-Order Optional
You can pass X-Sort-Order in the header and change the sorting order. By default, it will fetch the records in the Descending order.
Code Samples
curl -v\
-H "X-Master-key: <YOUR_API_KEY>" \
--request GET \
https://api.jsonbin.io/v3/c/<COLLECTION_ID>/bins
Request Response
Success Status Code: 200
[
{
"snippetMeta": {},
"private": true,
"record": "<RECORD_ID>",
"createdAt": "<DATE_TIME>"
},
...
]
Error Status Code: 400, 401, 403
{
"message": "<Error Message>"
}
For more information on the error codes & errors you might possibly encounter, refer to the below section.
Error Reference
Invalid Collection Id provided
Check if the Collection Id you've passed in the URL is valid and belongs to your account.