A few things before we start.

The Management API exposes various services to enable your servers or any third-party application to interact with WonderPush, to make your applications more successful by leveraging the power of notifications. It enables you to perform administrative tasks and manage your applications, users, installations, push campaigns... Basically all that can be done via your web dashboard can be done using these APIs.

You will only need two things to get started:

  1. Your credentials that are located on WonderPush dashboard under Settings > Configuration > Management API.
    Take note of the access token.

  2. Some tool to perform HTTP calls:

  • (Simplest) Use the API Explorer on this page!
  • (Production ready) Use our PHP library.
  • (Classic) A linux console, with the curl utility installed.
  • (Accessible) Use a handy browser extension. Try Advanced REST client for Chrome, REST Easy for Firefox.
  • (Harder to setup) A windows console, with curl manually installed.
    You will need to adapt the quoting of the proposed examples by using " instead of ' and escaping the inner " using so they become ^".
  • (You name it!) As long as you can perform a POST call to our HTTPS API, you're covered.

Examples

Code samples are displayed on the right column.
Here is an example call to a phony end-point. to serve as a basis:

curl -XPOST https://management-api.wonderpush.com/v1/SOME-ENDPOINT \
    -d accessToken=YOUR_APPLICATION_ACCESS_TOKEN
    -d someExampleObjectParam='{"json":"properly formatted, UTF-8 encoded and escaped"}'
    -d someExampleArrayParam=comma,separated,values
<?php
// Use https://github.com/wonderpush/wonderpush-php-lib

// Our library has an easy API for each endpoint!
// Take a look at POST /deliveries.

// For completeness, here is how you would place an arbitrary call

$wonderpush = new \WonderPush\WonderPush(YOUR_APPLICATION_ACCESS_TOKEN, YOUR_APPLICATION_ID);
$response = $wonderpush->rest()->post('/SOME-ENDPOINT', [
		'someExampleObjectParam' => ["json" => "properly formatted, UTF-8 encoded and escaped"],
    'someExampleArrayParam' => ["some" , "values"],
]);

if ($response->getStatusCode() === 0) {
	echo 'Error ' . $response->getHeaders()[self::HEADER_CURL_ERROR];
} else if ($response->parsedBody() instanceof \Exception) {
  echo 'Parsing error ' . $response->parseErrorMsg() . ' with body ' . $response->getRawBody();
} else if ($response->getStatusCode() < 200 || $response->getStatusCode() > 299) {
  echo 'Error ' . $response->getStatusCode() . ': ' . json_encode($response->parsedBody());
} else {

  echo 'Success: ' . json_encode($response->parsedBody());

}
<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://management-api.wonderpush.com/v1/SOME-ENDPOINT");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
    'accessToken' => "YOUR_APPLICATION_ACCESS_TOKEN",
    'someExampleObjectParam' => json_encode(["json" => "properly formatted, UTF-8 encoded and escaped"]),
    'someExampleArrayParam' => implode(', ', ["comma", "separated", "values"]),
)));

$rawResponse = curl_exec($ch);

if (curl_errno($ch)) {

    echo 'Error: ' . curl_error($ch);

} else {

    $response = json_decode($rawResponse, true);
    if (isset($response['success']) && $response['success'] === true) {
        echo 'Success';
    } else if (isset($response['error']['status'])
               && isset($response['error']['code'])
               && isset($response['error']['message'])) {
        echo 'Error ' . $response['error']['status']
          . ' code ' . $response['error']['code']
          . ': ' . $response['error']['message'];
    } else {
        echo 'Error: ' . $rawResponse;
    }

}

curl_close($ch);
# When using the Windows CMD Shell, you must adapt the quotes and escaping:
# For instance: param='{"json":"value"}'
# becomes:      param="{^"json^":^"value^"}"

curl -XPOST https://management-api.wonderpush.com/v1/SOME-ENDPOINT \
    -d accessToken=YOUR_APPLICATION_ACCESS_TOKEN
    -d someExampleObjectParam="{^"json^":^"properly formatted, UTF-8 encoded and escaped^"}"
    -d someExampleArrayParam=comma,separated,values