If you use DoYouBuzz Showcase or DoYouBuzz Campus, you can access the datas of your application, users and CV with this this API.
API keys are managed by an administrator of your Showcase / Campus account, under Settings, then API. From that page you can create as many keys as you need, and revoke them at any time.
Each key is made of two values:
| Value | Description |
|---|---|
| Public key | Looks like shw_live_3f9a1c74be2058d6a1f4c39e7b0d82f4. This is the value you send as the apikey parameter of every request. It stays visible in the settings page. |
| Secret | A 64 characters hexadecimal string, used to sign your requests. It is displayed only once, right after the creation of the key, and can never be read again: store it in your application configuration immediately. If you lose it, revoke the key and create a new one. |
When creating a key you choose its lifetime: unlimited, 30, 90 or 365 days. An expired or revoked key is refused exactly like an unknown one.
The API consumption page of the same settings section shows your traffic, your rate limits and the calls that have been rejected, per key and per endpoint.
GET | PUT | POST | DELETE https://showcase.doyoubuzz.com/api/v1/<method>?apikey=:apikey×tamp=:timestamp&nonce=:nonce&hash=:hash
There are a few mandatory parameters for each request made to the Showcase API :
| Parameter | Description |
|---|---|
| apikey (mandatory) |
The public key of your application (shw_live_…), obtained in the "Settings", then "API" section of your DoYouBuzz Showcase account.
|
| timestamp (mandatory) | The Unix timestamp of your request, in seconds (10 digits). Your request is accepted only if this timestamp is less than 5 minutes (300 seconds) away from the server time, in the past or in the future. |
| nonce (mandatory) | A random value, unique for each request (a UUID or a few random hexadecimal bytes are perfect). Never reuse one: replaying an already signed URL is rejected. |
| hash (mandatory) | The signature of your request, that you must compute and send for each call. A detailed explanation with a code example is given below. |
The hash is an HMAC SHA-256 of a canonical representation of your request, keyed with your secret. Because the HTTP method and the path are part of what you sign, a signed URL cannot be replayed on another endpoint.
\n).
GET, POST, PUT or DELETE.https://showcase.doyoubuzz.com/api/v1/users/666?apikey=… the path is /api/v1/users/666.hash, sort them by parameter name, encode both the name and the value with a RFC 3986 encoding (rawurlencode() in PHP, encodeURIComponent() in JavaScript), write them as name=value and join them with &. A parameter holding an array must be JSON encoded before being URL encoded.hash parameter.This function takes the HTTP method, the path of the request, an associative array of the parameters to send, and the secret of your key. It returns the parameters with the computed hash added :
function computeHash($method, $pathInfo, $params, $apiSecret)
{
unset($params['hash']);
ksort($params);
$pairs = array();
foreach ($params as $paramKey => $paramVal) {
if (is_array($paramVal)) {
$paramVal = json_encode($paramVal);
}
$pairs[] = rawurlencode($paramKey) . '=' . rawurlencode($paramVal);
}
$canonical = strtoupper($method) . "\n" . $pathInfo . "\n" . implode('&', $pairs);
return array_merge($params, array('hash' => hash_hmac('sha256', $canonical, $apiSecret)));
}
Let's say you want to get the user with the id 666. According to the documentation you need to send a GET to https://showcase.doyoubuzz.com/api/v1/users/666 with these parameters :
| Parameter name | Parameter value |
|---|---|
| apikey | shw_live_3f9a1c74be2058d6a1f4c39e7b0d82f4 |
| timestamp | 1774267200 |
| nonce | 7b1f4c9a2e8d6035 |
| hash | ??? |
So, let's compute the hash!
GET, the path is /api/v1/users/666, and the parameters sorted by name give apikey=shw_live_3f9a1c74be2058d6a1f4c39e7b0d82f4&nonce=7b1f4c9a2e8d6035×tamp=1774267200 (none of these values needs to be escaped). Joined by line feeds, the canonical string is :
GET /api/v1/users/666 apikey=shw_live_3f9a1c74be2058d6a1f4c39e7b0d82f4&nonce=7b1f4c9a2e8d6035×tamp=1774267200
c4e1a9f7b2d85630fa47e91c8b0d2356e7f1a4c980b3d62e5f8a17c4b9d0e236, and you get your hash parameter : be49e8c3daffdfe07b90fd1ee47f3062960f82bba4238b2ec244fbbacc63d621Now, you can send the request to the API :
GET https://showcase.doyoubuzz.com/api/v1/users/666?apikey=shw_live_3f9a1c74be2058d6a1f4c39e7b0d82f4×tamp=1774267200&nonce=7b1f4c9a2e8d6035&hash=be49e8c3daffdfe07b90fd1ee47f3062960f82bba4238b2ec244fbbacc63d621
Every authentication problem is answered with a 403, whatever its cause: missing parameter, unknown / revoked / expired key, timestamp out of the 5 minutes window, wrong signature, or reused nonce.
For security reasons, an unknown key, a revoked key and an expired key all share the very same message ("This api key is not valid!"), so you cannot tell them apart from the response. If you get a 403 while your signature code is known to work, check the state of your key in the settings page.
Note that the body of a 403 is a plain error response, it does not use the JSON envelope of the 429 described in the rate limiting page.
This section only concerns the API keys created before the introduction of the key manager. They keep working, unchanged, with the historical signature scheme: no nonce, and a MD5 signature. If you are integrating the API today, or if you created your key from the "API" settings page, use the HMAC scheme described above instead.
This function takes two parameters : an associative arrays of the parameters to send, and the apiSecret :
function computeHash($params, $apiSecret)
{
$paramsStr = "";
ksort($params);
foreach ($params as $paramKey => $paramVal) {
$paramsStr .= $paramVal;
}
$hash = md5($paramsStr . $apiSecret);
return array_merge($params, array('hash' => $hash));
}
Let's say you want to get the CV with the id 16546 (you have previously verified you can access this ressource). To do so, according to the documentation you need to send a GET to https://showcase.doyoubuzz.com/api/v1/dyb/cv/16546 with these parameters :
| Parameter name | Parameter value |
|---|---|
| timestamp | 1359021513 |
| apikey | IuQSDLKQLSDK344590Li987 |
| hash | ??? |
So, let's compute the hash!
IuQSDLKQLSDK344590Li9871359021513.IuJyt42BnUiOlPM8FvB67tG. You will have the resulting string : IuQSDLKQLSDK344590Li9871359021513IuJyt42BnUiOlPM8FvB67tG.44f36e1dd04a10c0be21b2d8e880f22bNow, you can send the request to the API :
GET https://showcase.doyoubuzz.com/api/v1/dyb/cv/16546?apikey=IuQSDLKQLSDK344590Li987×tamp=1359021513&hash=44f36e1dd04a10c0be21b2d8e880f22b