Introduction
This documentation aims to provide all the information you need to work with our API.
Authenticating requests
To authenticate requests, include a X-Api-Key header with the value "{YOUR_AUTH_KEY}".
All authenticated endpoints are marked with a requires authentication badge in the documentation below.
Endpoints
Returns a page of campaigns.
requires authentication
Example request:
curl --request GET \
--get "https://api.direct-result.be/v1/campaigns?count=25&page=1" \
--header "X-Api-Key: {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.direct-result.be/v1/campaigns"
);
const params = {
"count": "25",
"page": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Api-Key": "{YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": [
{
"id": 92,
"name": "Duis Dictum",
"active": true,
"phone_number": "+32809204909",
"enable_emergency_signature": true,
"enable_calling": true,
"enable_sms_verification": true
}
],
"per_page": 100,
"current": 1,
"next": null,
"previous": null,
"total": 1
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Returns a page of subscriptions.
requires authentication
(Note: you will only be able to see the subscriptions that were enrolled within the past month)
Example request:
curl --request GET \
--get "https://api.direct-result.be/v1/subscriptions?attributes=1&campaign=32&status=completed&before=1970-01-01&after=1970-01-01&count=25&page=1" \
--header "X-Api-Key: {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.direct-result.be/v1/subscriptions"
);
const params = {
"attributes": "1",
"campaign": "32",
"status": "completed",
"before": "1970-01-01",
"after": "1970-01-01",
"count": "25",
"page": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"X-Api-Key": "{YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());Example response (200):
{
"data": [
{
"id": 473774,
"status": "completed",
"amount": 1200,
"iban": "BE47549454364380",
"datetime_of_registration": "2020-01-01T00:00:00+01:00",
"datetime_of_cancelation": "2020-01-01T00:00:00+01:00",
"start_date": "2020-01-01T00:00:00+01:00",
"payment_interval": "0 years 1 mons 0 days 0 hours 0 mins 0.0 secs",
"payment_interval_clean": "MONTHLY",
"product_id": 42,
"client_ref_code": "",
"source": "sms",
"creditation": false,
"cancel_payment_recruiter": false,
"purged": false,
"first_payment_amount": 0,
"purchase_id": "",
"transaction_id": "",
"used_first_pay": false,
"is_structural": true,
"is_onetimer": false,
"is_cancellation": false,
"subscriber": {
"id": 495301,
"first_name": "Shay",
"middle_name": "",
"last_name": "Marta",
"gender": "female",
"date_of_birth": "1980-01-01T00:00:00+01:00",
"mobile": "+32585834200",
"email": "shaymarta@localhost.com",
"street": "Generaal Dossin de Saint Georgeslaan",
"house_number": 13,
"house_number_suffix": "",
"city": "Brussels",
"country": "BE",
"initials": "",
"landline": "",
"zip_code": "1050",
"bic": "BELLKM",
"spoken_language": "FR"
},
"recruiter": {
"code": "132406",
"name": "Richard"
},
"welcome_call": {
"status": "confirmed",
"call_date": "2020-01-01"
},
"metadata": {
"values": {
"foo": [
"Particulier"
]
},
"attributes": {
"foo": {
"slug": "foo",
"choices": [
"Particulier",
"Societe"
],
"type": "choice",
"metadata": {
"Societe": {
"label": "Sociéte"
},
"Particulier": {
"label": "Particulier"
}
},
"label": "Je suis",
"value_type": "text",
"required": true
}
}
},
"campaign": {
"id": 92,
"name": "Duis Dictum",
"active": true,
"phone_number": "+32809204909",
"enable_emergency_signature": true,
"enable_calling": true,
"enable_sms_verification": true
}
}
],
"per_page": 1,
"current": 1,
"next": 2,
"previous": null,
"total": 576
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Marks one or multiple subscriptions for completion.
requires authentication
(Note: you can only mark subscriptions that were enrolled within the past month)
Example request:
curl --request POST \
"https://api.direct-result.be/v1/subscriptions/complete" \
--header "X-Api-Key: {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"subscriptions\": [
1,
2,
3
]
}"
const url = new URL(
"https://api.direct-result.be/v1/subscriptions/complete"
);
const headers = {
"X-Api-Key": "{YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"subscriptions": [
1,
2,
3
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (204):
Empty response
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.