Hello Developers!
This tutorial is in order to get your requests using the version 1.0 of Sandbox BotDoc API. In order to use this version, you have to put “v1” on the API’s endpoint.
To a better understanding about the versioning, please go to api.botdoc.io/documentation/#versioning
and to a better understanding about the Sandbox, please go to api.botdoc.io/documentation/#sandbox-platform
1. Getting your requests:
In order to get a list of your requests you have to make a request to:
https://sandboxapi.botdoc.io/v1/auth/request/ as GET and you can use 2 parameters:
page
to return the result set based on this page number (starting from 1, not 0), and page_size
that is the number of results per page.
If you don’t pass any parameter, page
‘s default is 1 and page_size
‘s default is 10.
If you send a request like this: https://api.botdoc.io/v1/request/?page=2&page_size=5 (always remember sending token on header)
The response will look like the example below:
{ "links": { "previous": "https://api.botdoc.io/v1/request/?page_size=5", "next": "https://api.botdoc.io/v1/request/?page=3&page_size=5" }, "total_pages": 4, "count": 18, "results": [{ "id": 5457, "identifier": "820aeeb52ad0707xxxxxxxxxxxxxxxxx", ... }, ...{ "id": 5459, "identifier": "b63202468ca4cb029fxxxxxxxxxxxxxxxxxb", ... } ] }
The links
is an array of strings, that always contains previous
and next
.
The previous
is the URL to request the previous page, returns null when it’s the first page.
The next
is the URL to request the next page, returns null when it’s the last page.
The total_pages
returns the total of pages.
The count
returns the total requests
and the results
return an array of requests.
2. Getting a specific request:
In order to get a specific request you have to make a request to:
https://sandboxapi.botdoc.io/v1/auth/request/{request-id} as GET
and the response will look like the example below:
{ "id": 4578, "identifier": "c0ea665eefe04exxxxxxxxxxxxxxxxx", "message": "a nice message here", "receiver_message": "the response message here", "requestor_privatenotes": "my private message here", "is_sending": false, "requestor_notified": true, "is_draft": false, "complete": true, "short_message": "a short message here. https://sandboxapi.botdoc.io/r/c0ea665eefe04exxxxxxxxxxxxxxxxx/", "contact_notification_send": [], "long_message_subject": "John Doe is requesting documents from you", "long_message": "a loong message here. https://sandboxapi.botdoc.io/r/c0ea665eefe04exxxxxxxxxxxxxxxxx/", "contact": [{ "id": 9, "first_name": "John", "last_name": "Doe", "contactmethod": [{ "id": 16, "interface_class": "email", "value": "[email protected]", "created": "2018-01-24T19:12:35Z", "updated": "2018-01-24T19:12:35Z" }], "created": "2018-01-24T19:12:35Z", "updated": "2018-01-24T19:12:35Z" }], "media": [{ "id": 33, "request": 80, "name": "image.png", "content_type": "image/png", "bytes": 71693, "extension": "png", "file": "45a8941c82ed10d0xxxxxxxxxxxxxxxx.png", "created": "2018-01-24T19:25:50Z", "updated": "2018-01-24T19:25:50Z" }, { "id": 34, "request": 80, "name": "business_plan.docx", "content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "bytes": 15091, "extension": "docx", "file": "9e527bbe00fa950xxxxxxxxxxxxxxxx.docx", "created": "2018-01-24T19:25:52Z", "updated": "2018-01-24T19:25:52Z" } ], "callback_url": null, "created": "2018-01-24T19:25:28Z", "updated": "2018-01-24T19:26:10Z" }
For more details about getting your requests you can take a look at our BotDoc API Reference on api.botdoc.io/documentation/#getting-your-requests