View All Contacts
Endpoint
[GET] https://usenotifier.com/api/contacts
Example Request
$response = Http::withToken('YOUR_API_KEY')
->get('https://usenotifier.com/api/contacts');
Example Response
The response contains a collection of paginated contacts. Each contact has one or many contact methods. A contact method contains a contact type, e.g. phone and an address e.g. a phone number in international format.
{
"data": [
{
"uuid": "0338181e-358c-41f4-b914-8533df524aae",
"firstname": "John",
"lastname": "Smith",
"created_at": "2022-09-01T15:45:32.000000Z",
"contact_methods": [
{
"uuid": "6e7b6c86-4d24-41e4-9328-ec55ac088e9a",
"type": "phone",
"address": "+447700900389",
"created_at": "2022-09-06T15:45:32.000000Z",
"updated_at": "2022-09-06T15:45:32.000000Z"
}
]
},
{
"uuid": "15687ee9-f1fa-42e3-b58a-a0fd5c6de6fd",
"firstname": "Jane",
"lastname": "Doe",
"created_at": "2022-09-01T15:45:32.000000Z",
"contact_methods": [
{
"uuid": "367b56e3-f8ab-4807-9cb8-9250a95f5386",
"type": "phone",
"address": "+447549936883",
"created_at": "2022-09-20T10:24:48.000000Z",
"updated_at": "2022-09-20T10:24:48.000000Z"
}
]
}
],
"links": {
"first": "https://notifier.test/api/contacts?page=1",
"last": "https://notifier.test/api/contacts?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://notifier.test/api/contacts?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "https://notifier.test/api/contacts",
"per_page": 25,
"to": 15,
"total": 15
}
}
Pagination
The meta
object at the end of the response contains pagination links and variables. You can use these within your code to keep a track of how many more requests you need to make to retrieve all contacts. To get the next page of results, simple add a page parameter. For example:
https://usenotifier.com/api/contacts?page=2 //page 2
https://usenotifier.com/api/contacts?page=3 //page 3
Last updated
Was this helpful?