What is the Daisycon API Sandbox?
The Daisycon API Sandbox is a testing and development environment that replicates the functionality of the Daisycon API resources. It allows you to develop and test your applications without the risk of modifying live data. With the sandbox, you can select your data, perform insert, update, and delete queries, and validate your integration before going live.
Any changes made in the sandbox do not affect live data, ensuring a secure and controlled testing environment.
Sandbox and Live API Endpoints
-
Live (Production):
https://services.daisycon.com
-
Sandbox (Testing):
https://services-sandbox.daisycon.com
Note: The sandbox environment has a rate limit of 15 requests per minute per IP address.
API Error Codes
The Daisycon API uses the standard HTTP status codes. However, a response can have several reasons, please check out the resources for the specific error codes for your request.
Example Codes for Daisycon API
Below is an example of PHP code to retrieve transactions for the current month in your publisher account. For additional examples, visit our repositories on GitHub:
PHP Example: Getting your transactions
The following PHP code retrieves transactions for the current month. Ensure you have set up your own oAuth handshake for authentication. Refer to our GitHub examples for details on token refresh and expiry.
// Get OAuth token (function should return a valid token)
$token = getOAuthToken();
// Fetch publishers
$publishers = performCall($token, '/publishers');
foreach ($publishers as $publisher) {
$start = date('Y-m-01');
$end = date('Y-m-d');
echo 'Fetching transactions for: ' . $publisher-name . ' (' . $publisher-id . ') - ' . $start . ' - ' . $end, PHP_EOL;
$page = 1;
$perPage = 1000;
do {
$transactions = performCall($token, "/publisher/{$publisher-id}/transactions", [
'start' = $start,
'end' = $end,
'page' = $page,
'per_page' = $perPage,
]);
// Process transactions here
$page++;
} while (!empty($transactions));
}
// Example API call function
function performCall($token, $endpoint, $params = []) {
$baseUrl = 'https://services.daisycon.com';
$url = $baseUrl . $endpoint . '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer {$token}",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}