NAV

    Introduction

    What is Catapush?

    Catapush is a simple, reliable and scalable delivery API for transactional push notifications for mobile and web applications

    What is API documentation for?

    Simple APIs allow you to integrate the Catapush’s reliable Mobile Push Notification Gateway into your mobile and web application, quickly and simply. In the following paragraphs we’ll show you how to send push messages and receive single message status report using various different programming languages.
    If you need any assistance in getting our APIs working, we’ll be happy to help.

    Authentication

    To call authenticated endpoints you have to provide a token.

    This token (usually called access_token) can be provided:

    • in the header of the request Authorization:Bearer TOKEN (preferred way, suggested by OAuth2 RFC);
    • as the HTTP Parameter access_token.

    There are two types of access_token:

    • a permanent token that is displayed inside your panel, it will never change until you manually regenerate it;
    • a temporary access token obtained through the OAuth2 endpoint (client_id and client_secret, available in your panel, must be provided for the Client Credentials Grant).

    Rest alternatives - SOAP

    Instead of REST endpoints, Catapush also support a SOAP (Simple Object Access Protocol) endpoint. The WSDL is available at

    http://api.catapush.com/soap/1/?wsdl

    .

    By clicking the soap label on the top right corner you will be able to see some examples of SOAP request and response for each endpoint.

    Validation

    Some query parameters and json properties are validated against length restrictions or regex patterns, that are highlighted in the following documentation. By using the schema provided for some endpoints it is possible to validate a json object using tools like Json Schema Lint validator. “Safe Characters” refers to those properties that must not contain non-printable and non-utf8 characters (this is done to enforce a safe encoding that is supported by most devices). This restriction can be bypassed by using an encoding scheme like Base64.

    Errors

    In case of errors, the APIs provide information in two different ways:

    • in the response header through status code and header messages;
    • in the response body.

    Error status codes are in the range 4xx (errors that can be corrected by the user) or 5xx (errors related to the service).

    Typical response body is:

    {
      "detail": "Detailed description of the error",
      "status": 403,
      "title": "Short description of the error"
    }
    


    The title of the response, also present in the header, is immutable, so that it can be used together with the status code to trigger specific actions while developing the api. Many titles are shared throught differente APIs.
    The detail field, instead, can vary depending of api version and developers should not embed them in their code.


    The Catapush API may return following errors:

    Error Code Title
    400 Bad Request - Missing Required Parameters
    401 Unauthorised - Bad or expired token
    403 Forbidden - Wrong authentication
    403 Forbidden - Bad OAuth request

    SMS Fallback

    Reach your users even when they lost mobile data connectivity. Catapush system can automatically send an SMS to all users who didn’t receive the push notification within a predefined timeframe after message expiry.

    To send them, Catapush has partnered with Skebby, a company that delivers SMS internationally at the best price available. Furthermore it has been proven to be very reliable and scalable.

    To setup the integration please follow the instructions provided in the SMS Fallback Panel in your app panel: you will need to enter the Skebby account details and set their settings appropriately.

    You can then enable SMS Fallback for every push sent through the fallback property available in the push notification object: check the related section for more details (expand the optional fields).

    API:

    Follows the specifications of the endpoints available. Check the right column for a snippet of code based on the example available for each method.

    1 Authentication

    Generate authentication tokens or invalidate them. Authentication tokens must be provided to authenticated endpoints. A permanent authentication token is provided in the client panel.

    1.1 OAuth authentication

    You can authenticate using OAuth2 protocol. The only currently supported method is client_credentials.

    1.1.1 POST - Acquire an access token

    Get access token

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request POST \
      --url 'https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials' \
      --header 'accept: application/json' \
      --header 'content-type: application/json'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.post("https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .asString();
    
    var data = null;
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "POST",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials");
    var request = new RestRequest(Method.POST);
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials"
    
        req, _ := http.NewRequest("POST", url, nil)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Post.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json"
        }
    
    conn.request("POST", "/1/auth/oauth?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=client_credentials", headers=headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:authOauthCreate>
             <params>
                <client_id>user1</client_id>
                <client_secret>pass1</client_secret>
                <grant_type>client_credentials</grant_type>
             </params>
          </soap:authOauthCreate>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:authOauthCreateResponse>
             <authOauthCreateResult>
                <grant_type>client_credentials</grant_type>
                <access_token>ACCESS_TOKEN</access_token>
             </authOauthCreateResult>
          </ns1:authOauthCreateResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    Acquire an access token in various fashions, depending on the value of **grant_type**:

    • `client_credentials`
      Exchanges your client credentials for an *access token* via HTTP basic authentication as described in the [OAuth 2.0 Specification Section 4.4](http://tools.ietf.org/html/rfc6749#section-4.4). Both client_id and client_secret (which can be found in your panel) have to be sent. This token expire after some hours (differently from the one provided through your dashboard, which is permanent).

    HTTP Request

    POST https://api.catapush.com/1/auth/oauth

    Query Parameters

    ParameterRequiredDefaultDescription
    client_idfalseThe client id
    client_secretfalseThe client secret
    grant_typefalseGrant method, actually only `client_credentials` is supported

    Responses

    200 - Returns the current (or newly issued) access token (“Bearer Token”)

    Content-type: application/json
    Examples:

    {
        "grant_type": "client_credentials",
        "access_token": "2YotnFZFEjr1zCsicMWpAA"
    }
    

    400 - HTTP 400 [bad request]

    See rfc6749#section-5.2 for a detailed explanation of all possible error responses and how to interpret them

    Content-type: application/json
    Examples:

    {
        "error": "invalid_request"
    }
    

    1.1.2 DELETE - Invalidate every access token

    Invalidate access token

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/auth/oauth",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "DELETE",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "authorization: Bearer ACCESS_TOKEN",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request DELETE \
      --url https://api.catapush.com/1/auth/oauth \
      --header 'accept: application/json' \
      --header 'authorization: Bearer ACCESS_TOKEN' \
      --header 'content-type: application/json'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.delete("https://api.catapush.com/1/auth/oauth")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .header("authorization", "Bearer ACCESS_TOKEN")
      .asString();
    
    var data = null;
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("DELETE", "https://api.catapush.com/1/auth/oauth");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Bearer ACCESS_TOKEN");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "DELETE",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/auth/oauth",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": "Bearer ACCESS_TOKEN"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/auth/oauth");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "authorization: Bearer ACCESS_TOKEN");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/auth/oauth");
    var request = new RestRequest(Method.DELETE);
    request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/auth/oauth"
    
        req, _ := http.NewRequest("DELETE", url, nil)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
        req.Header.Add("authorization", "Bearer ACCESS_TOKEN")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/auth/oauth")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Delete.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer ACCESS_TOKEN'
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json",
        'authorization': "Bearer ACCESS_TOKEN"
        }
    
    conn.request("DELETE", "/1/auth/oauth", headers=headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:authOauthDeleteList>
             <auth>
                <access_token>ACCESS_TOKEN</access_token>
             </auth>
          </soap:authOauthDeleteList>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:authOauthDeleteListResponse>
             <authOauthDeleteListResult>true</authOauthDeleteListResult>
          </ns1:authOauthDeleteListResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    Invalidate every access token for your user

    HTTP Request

    DELETE https://api.catapush.com/1/auth/oauth

    Query Parameters

    ParameterRequiredDefaultDescription
    access_tokenfalseUsed to send a valid access token. Do not use together with the “Authorization” header

    Responses

    200 - Access token deleted correctly

    401 - Bad or expired token. This can happen if the user or Catapush revoked or expired an access token. To fix, you should re-authenticate the user.

    403 - Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…). Unfortunately, re-authenticating the user won’t help here.

    2 Message

    Send a push message to your users.

    2.1 POST - Send a new message

    Send a message

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/messages",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "{ \"mobileAppId\":2, \"text\":\"lorem ipsum dolor\", \"recipients\":[ { \"identifier\":\"johndoe\", \"recipientRef\":\"testreference-johndoe\" } ], \"notificationText\":\"notification message\", \"messageRef\":\"testreference\", \"devicesData\":{ \"ios\":{ \"sound\":false, \"badge\":2, \"soundPath\":\"folder/sound.mp3\", \"category\":\"test\", \"customData\":{ \"exampleKey\":\"exampleValue\" } }, \"android\":{ \"title\":\"test\" } }, \"notifyCallback\":{ \"method\":\"post\", \"url\":\"http://yoursite/notify-callback\" } }",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "authorization: Bearer ACCESS_TOKEN",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request POST \
      --url https://api.catapush.com/1/messages \
      --header 'accept: application/json' \
      --header 'authorization: Bearer ACCESS_TOKEN' \
      --header 'content-type: application/json' \
      --data '{ "mobileAppId":2, "text":"lorem ipsum dolor", "recipients":[ { "identifier":"johndoe", "recipientRef":"testreference-johndoe" } ], "notificationText":"notification message", "messageRef":"testreference", "devicesData":{ "ios":{ "sound":false, "badge":2, "soundPath":"folder/sound.mp3", "category":"test", "customData":{ "exampleKey":"exampleValue" } }, "android":{ "title":"test" } }, "notifyCallback":{ "method":"post", "url":"http://yoursite/notify-callback" } }'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.post("https://api.catapush.com/1/messages")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .header("authorization", "Bearer ACCESS_TOKEN")
      .body("{ \"mobileAppId\":2, \"text\":\"lorem ipsum dolor\", \"recipients\":[ { \"identifier\":\"johndoe\", \"recipientRef\":\"testreference-johndoe\" } ], \"notificationText\":\"notification message\", \"messageRef\":\"testreference\", \"devicesData\":{ \"ios\":{ \"sound\":false, \"badge\":2, \"soundPath\":\"folder/sound.mp3\", \"category\":\"test\", \"customData\":{ \"exampleKey\":\"exampleValue\" } }, \"android\":{ \"title\":\"test\" } }, \"notifyCallback\":{ \"method\":\"post\", \"url\":\"http://yoursite/notify-callback\" } }")
      .asString();
    
    var data = JSON.stringify({
      "mobileAppId": 2,
      "text": "lorem ipsum dolor",
      "recipients": [
        {
          "identifier": "johndoe",
          "recipientRef": "testreference-johndoe"
        }
      ],
      "notificationText": "notification message",
      "messageRef": "testreference",
      "devicesData": {
        "ios": {
          "sound": false,
          "badge": 2,
          "soundPath": "folder/sound.mp3",
          "category": "test",
          "customData": {
            "exampleKey": "exampleValue"
          }
        },
        "android": {
          "title": "test"
        }
      },
      "notifyCallback": {
        "method": "post",
        "url": "http://yoursite/notify-callback"
      }
    });
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.catapush.com/1/messages");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Bearer ACCESS_TOKEN");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "POST",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/messages",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": "Bearer ACCESS_TOKEN"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(JSON.stringify({ mobileAppId: 2,
      text: 'lorem ipsum dolor',
      recipients:
       [ { identifier: 'johndoe', recipientRef: 'testreference-johndoe' } ],
      notificationText: 'notification message',
      messageRef: 'testreference',
      devicesData:
       { ios:
          { sound: false,
            badge: 2,
            soundPath: 'folder/sound.mp3',
            category: 'test',
            customData: { exampleKey: 'exampleValue' } },
         android: { title: 'test' } },
      notifyCallback: { method: 'post', url: 'http://yoursite/notify-callback' } }));
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/messages");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "authorization: Bearer ACCESS_TOKEN");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"mobileAppId\":2, \"text\":\"lorem ipsum dolor\", \"recipients\":[ { \"identifier\":\"johndoe\", \"recipientRef\":\"testreference-johndoe\" } ], \"notificationText\":\"notification message\", \"messageRef\":\"testreference\", \"devicesData\":{ \"ios\":{ \"sound\":false, \"badge\":2, \"soundPath\":\"folder/sound.mp3\", \"category\":\"test\", \"customData\":{ \"exampleKey\":\"exampleValue\" } }, \"android\":{ \"title\":\"test\" } }, \"notifyCallback\":{ \"method\":\"post\", \"url\":\"http://yoursite/notify-callback\" } }");
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/messages");
    var request = new RestRequest(Method.POST);
    request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    request.AddParameter("application/json", "{ \"mobileAppId\":2, \"text\":\"lorem ipsum dolor\", \"recipients\":[ { \"identifier\":\"johndoe\", \"recipientRef\":\"testreference-johndoe\" } ], \"notificationText\":\"notification message\", \"messageRef\":\"testreference\", \"devicesData\":{ \"ios\":{ \"sound\":false, \"badge\":2, \"soundPath\":\"folder/sound.mp3\", \"category\":\"test\", \"customData\":{ \"exampleKey\":\"exampleValue\" } }, \"android\":{ \"title\":\"test\" } }, \"notifyCallback\":{ \"method\":\"post\", \"url\":\"http://yoursite/notify-callback\" } }", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "strings"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/messages"
    
        payload := strings.NewReader("{ \"mobileAppId\":2, \"text\":\"lorem ipsum dolor\", \"recipients\":[ { \"identifier\":\"johndoe\", \"recipientRef\":\"testreference-johndoe\" } ], \"notificationText\":\"notification message\", \"messageRef\":\"testreference\", \"devicesData\":{ \"ios\":{ \"sound\":false, \"badge\":2, \"soundPath\":\"folder/sound.mp3\", \"category\":\"test\", \"customData\":{ \"exampleKey\":\"exampleValue\" } }, \"android\":{ \"title\":\"test\" } }, \"notifyCallback\":{ \"method\":\"post\", \"url\":\"http://yoursite/notify-callback\" } }")
    
        req, _ := http.NewRequest("POST", url, payload)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
        req.Header.Add("authorization", "Bearer ACCESS_TOKEN")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/messages")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Post.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer ACCESS_TOKEN'
    request.body = "{ \"mobileAppId\":2, \"text\":\"lorem ipsum dolor\", \"recipients\":[ { \"identifier\":\"johndoe\", \"recipientRef\":\"testreference-johndoe\" } ], \"notificationText\":\"notification message\", \"messageRef\":\"testreference\", \"devicesData\":{ \"ios\":{ \"sound\":false, \"badge\":2, \"soundPath\":\"folder/sound.mp3\", \"category\":\"test\", \"customData\":{ \"exampleKey\":\"exampleValue\" } }, \"android\":{ \"title\":\"test\" } }, \"notifyCallback\":{ \"method\":\"post\", \"url\":\"http://yoursite/notify-callback\" } }"
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    payload = "{ \"mobileAppId\":2, \"text\":\"lorem ipsum dolor\", \"recipients\":[ { \"identifier\":\"johndoe\", \"recipientRef\":\"testreference-johndoe\" } ], \"notificationText\":\"notification message\", \"messageRef\":\"testreference\", \"devicesData\":{ \"ios\":{ \"sound\":false, \"badge\":2, \"soundPath\":\"folder/sound.mp3\", \"category\":\"test\", \"customData\":{ \"exampleKey\":\"exampleValue\" } }, \"android\":{ \"title\":\"test\" } }, \"notifyCallback\":{ \"method\":\"post\", \"url\":\"http://yoursite/notify-callback\" } }"
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json",
        'authorization': "Bearer ACCESS_TOKEN"
        }
    
    conn.request("POST", "/1/messages", payload, headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:messagesCreate>
             <data>
                    <mobileAppId>2</mobileAppId>
                    <text>lorem ipsum dolor</text>
                    <recipients>
                        <item>
                            <identifier>johndoe</identifier>
                            <recipientRef>testreference-johndoe</recipientRef>
                        </item>
                    </recipients>
                    <notificationText>notification message</notificationText>
                    <messageRef>testreference</messageRef>
                    <devicesData>
                        <ios>
                            <sound/>
                            <badge>2</badge>
                            <soundPath>folder/sound.mp3</soundPath>
                            <category>test</category>
                            <customData>
                                <exampleKey>exampleValue</exampleKey>
                            </customData>
                        </ios>
                        <android>
                            <title>test</title>
                        </android>
                    </devicesData>
                    <notifyCallback>
                        <method>post</method>
                        <url>http://yoursite/notify-callback</url>
                    </notifyCallback>
             </data>
             <auth>
                <access_token>ACCESS_TOKEN</access_token>
             </auth>
          </soap:messagesCreate>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:messagesCreateResponse>
             <messagesCreateResult>
                    <messageId>id-test-message</messageId>
                    <createdAt>2015-04-26T01:37:17Z</createdAt>
                    <mobileAppId>2</mobileAppId>
                    <text>lorem ipsum dolor</text>
                    <recipients>
                        <item>
                            <identifier>johndoe</identifier>
                            <recipientRef>testreference-johndoe</recipientRef>
                        </item>
                    </recipients>
                    <notificationText>notification message</notificationText>
                    <messageRef>testreference</messageRef>
                    <devicesData>
                        <ios>
                            <sound/>
                            <badge>2</badge>
                            <soundPath>folder/sound.mp3</soundPath>
                            <category>test</category>
                            <customData>
                                <exampleKey>exampleValue</exampleKey>
                            </customData>
                        </ios>
                        <android>
                            <title>test</title>
                        </android>
                    </devicesData>
                    <notifyCallback>
                        <method>post</method>
                        <url>http://yoursite/notify-callback</url>
                    </notifyCallback>
             </messagesCreateResult>
          </ns1:messagesCreateResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    HTTP Request

    POST https://api.catapush.com/1/messages

    Query Parameters

    ParameterRequiredDefaultDescription
    access_tokenfalseUsed to send a valid access token. Do not use together with the “Authorization” header

    Body

    Content-type: application/json

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "Message",
        "description": "Message to be sent to a User",
        "type": "object",
        "properties": {
            "mobileAppId": {
                "description": "Unique identifier of the mobile app",
                "type": "integer"
            },
            "text": {
                "description": "Text of the message",
                "type": "string",
                "minLength": 1,
                "maxLength": 32768,
                "charset": "safe"
            },
            "recipients": {
                "title": "Define message recipients",
                "type": "array",
                "minItems": 1,
                "items": {
                    "title": "Recipient",
                    "type": "object",
                    "properties": {
                        "identifier": {
                            "description": "Identifier of the recipient (can be a phonenumber or the username used to login in the app)",
                            "type": "string",
                            "pattern": "^[!-~]{1,100}$"
                        },
                        "recipientRef": {
                            "description": "Custom identifier of the single dispatch to the recipient, expecially useful to track status",
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9._-]{5,100}$",
                            "charset": "safe"
                        },
                        "override": {
                            "title": "Override some parameters for the recipient",
                            "type": "object",
                            "properties": {
                                "text": {
                                    "description": "Override normal text for the recipient",
                                    "type": "string",
                                    "maxLength": 32768,
                                    "charset": "safe"
                                },
                                "mobileNumber": {
                                    "description": "Recipient number (international format without + or 00) used to send the SMS Fallback. By default the recipient identifier is used",
                                    "type": "string",
                                    "pattern": "^[0-9]{8,}$"
                                }
                            }
                        }
                    },
                    "required": [
                        "identifier"
                    ],
                    "defaultProperties": [
                        "identifier"
                    ]
                },
                "uniqueItems": true
            },
            "notificationText": {
                "description": "Text shown as the notification message from the device (in the notification bar). If not present, text is used",
                "type": "string",
                "minLength": 1,
                "maxLength": 400,
                "charset": "safe"
            },
            "messageRef": {
                "description": "Custom identifier of the message",
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{5,50}$",
                "charset": "safe"
            },
            "expireTime": {
                "description": "Seconds after creation after which the message is discarded if still undelivered (by default 2 days)",
                "type": "integer",
                "minimum": 1,
                "maximum": 2592000,
                "default": 172800
            },
            "isMarketing": {
                "description": "Set if the message is a marketing message",
                "type": "boolean",
                "default": false
            },
            "devicesData": {
                "title": "Push options for every device type",
                "type": "object",
                "properties": {
                    "ios": {
                        "title": "IOS devices",
                        "type": "object",
                        "properties": {
                            "sound": {
                                "description": "Play sound",
                                "type": "boolean",
                                "default": true
                            },
                            "badge": {
                                "description": "Badge number",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 2147483647,
                                "default": 0
                            },
                            "soundPath": {
                                "description": "Sound path (leave null for default)",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 32768
                            },
                            "category": {
                                "description": "Category used for custom actions",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 100
                            },
                            "customData": {
                                "description": "Custom object (see official Apple Documentation at http:\/\/apple.co\/1TXGePg for more details)",
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "default": null
                            }
                        }
                    },
                    "android": {
                        "title": "Android devices",
                        "type": "object",
                        "properties": {
                            "title": {
                                "description": "Title of the message",
                                "type": "string",
                                "maxLength": 400,
                                "charset": "safe"
                            }
                        }
                    }
                }
            },
            "notifyCallback": {
                "title": "Notify Callback",
                "description": "Endpoint used to receive notifications of message status changes, this can also be set on a per-app basis through the app panel",
                "type": "object",
                "properties": {
                    "url": {
                        "description": "Url used to send the callback",
                        "type": "string",
                        "format": "uri"
                    },
                    "method": {
                        "description": "Method used for the callback",
                        "type": "string",
                        "enum": [
                            "get",
                            "post"
                        ]
                    }
                },
                "required": [
                    "url",
                    "method"
                ]
            },
            "fallback": {
                "title": "SMS fallback",
                "description": "Enable the SMS fallback if condition is verified after a custom amount of time",
                "type": "object",
                "properties": {
                    "timeout": {
                        "description": "Seconds after which the message will be sent",
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 864000,
                        "default": 60
                    },
                    "validityPeriod": {
                        "description": "How many seconds the operator must retry to send the SMS in case of phone turned off or unreachable",
                        "type": "integer",
                        "minimum": 300,
                        "maximum": 864000,
                        "default": 172800
                    },
                    "condition": {
                        "description": "SMS will be sent if the condition specified is true after the specified amount of time",
                        "type": "string",
                        "enum": [
                            "undelivered",
                            "unread"
                        ],
                        "default": "undelivered"
                    },
                    "text": {
                        "description": "Text of the message (characters [,\\,],^,{,|,},~,\u20ac are long 2)",
                        "type": "string",
                        "maxLength": 1530,
                        "pattern": "^[\\u0020-\\u007E\u00a3\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\\r\u00d8\u00f8\n\u00c5\u00e5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\\u001B\u00c6\u00e6\u00df\u00c9 \u00a4\u00a1\u00c4\u00d6\u00d1\u00dc\u00a7\u00bf\u00e4\u00f6\u00f1\u00fc\u00e0\\u000C\u20ac]*$"
                    },
                    "senderNumber": {
                        "description": "Allows to specify any phone number you want as sender ID, the number must be in international format without + or 00, e.g.: 393334455666",
                        "type": "string",
                        "pattern": "^[0-9]*$"
                    },
                    "senderString": {
                        "description": "Allows to specify an alphanumeric string of maximum 11 characters to use as sender name",
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9 .]{0,11}$"
                    }
                }
            }
        },
        "required": [
            "mobileAppId",
            "text",
            "recipients"
        ],
        "defaultProperties": [
            "mobileAppId",
            "text",
            "recipients"
        ]
    }
    Schema:

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "Message",
        "description": "Message to be sent to a User",
        "type": "object",
        "properties": {
            "mobileAppId": {
                "description": "Unique identifier of the mobile app",
                "type": "integer"
            },
            "text": {
                "description": "Text of the message",
                "type": "string",
                "minLength": 1,
                "maxLength": 32768,
                "charset": "safe"
            },
            "recipients": {
                "title": "Define message recipients",
                "type": "array",
                "minItems": 1,
                "items": {
                    "title": "Recipient",
                    "type": "object",
                    "properties": {
                        "identifier": {
                            "description": "Identifier of the recipient (can be a phonenumber or the username used to login in the app)",
                            "type": "string",
                            "pattern": "^[!-~]{1,100}$"
                        },
                        "recipientRef": {
                            "description": "Custom identifier of the single dispatch to the recipient, expecially useful to track status",
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9._-]{5,100}$",
                            "charset": "safe"
                        },
                        "override": {
                            "title": "Override some parameters for the recipient",
                            "type": "object",
                            "properties": {
                                "text": {
                                    "description": "Override normal text for the recipient",
                                    "type": "string",
                                    "maxLength": 32768,
                                    "charset": "safe"
                                },
                                "mobileNumber": {
                                    "description": "Recipient number (international format without + or 00) used to send the SMS Fallback. By default the recipient identifier is used",
                                    "type": "string",
                                    "pattern": "^[0-9]{8,}$"
                                }
                            }
                        }
                    },
                    "required": [
                        "identifier"
                    ],
                    "defaultProperties": [
                        "identifier"
                    ]
                },
                "uniqueItems": true
            },
            "notificationText": {
                "description": "Text shown as the notification message from the device (in the notification bar). If not present, text is used",
                "type": "string",
                "minLength": 1,
                "maxLength": 400,
                "charset": "safe"
            },
            "messageRef": {
                "description": "Custom identifier of the message",
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{5,50}$",
                "charset": "safe"
            },
            "expireTime": {
                "description": "Seconds after creation after which the message is discarded if still undelivered (by default 2 days)",
                "type": "integer",
                "minimum": 1,
                "maximum": 2592000,
                "default": 172800
            },
            "isMarketing": {
                "description": "Set if the message is a marketing message",
                "type": "boolean",
                "default": false
            },
            "devicesData": {
                "title": "Push options for every device type",
                "type": "object",
                "properties": {
                    "ios": {
                        "title": "IOS devices",
                        "type": "object",
                        "properties": {
                            "sound": {
                                "description": "Play sound",
                                "type": "boolean",
                                "default": true
                            },
                            "badge": {
                                "description": "Badge number",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 2147483647,
                                "default": 0
                            },
                            "soundPath": {
                                "description": "Sound path (leave null for default)",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 32768
                            },
                            "category": {
                                "description": "Category used for custom actions",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 100
                            },
                            "customData": {
                                "description": "Custom object (see official Apple Documentation at http:\/\/apple.co\/1TXGePg for more details)",
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "default": null
                            }
                        }
                    },
                    "android": {
                        "title": "Android devices",
                        "type": "object",
                        "properties": {
                            "title": {
                                "description": "Title of the message",
                                "type": "string",
                                "maxLength": 400,
                                "charset": "safe"
                            }
                        }
                    }
                }
            },
            "notifyCallback": {
                "title": "Notify Callback",
                "description": "Endpoint used to receive notifications of message status changes, this can also be set on a per-app basis through the app panel",
                "type": "object",
                "properties": {
                    "url": {
                        "description": "Url used to send the callback",
                        "type": "string",
                        "format": "uri"
                    },
                    "method": {
                        "description": "Method used for the callback",
                        "type": "string",
                        "enum": [
                            "get",
                            "post"
                        ]
                    }
                },
                "required": [
                    "url",
                    "method"
                ]
            },
            "fallback": {
                "title": "SMS fallback",
                "description": "Enable the SMS fallback if condition is verified after a custom amount of time",
                "type": "object",
                "properties": {
                    "timeout": {
                        "description": "Seconds after which the message will be sent",
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 864000,
                        "default": 60
                    },
                    "validityPeriod": {
                        "description": "How many seconds the operator must retry to send the SMS in case of phone turned off or unreachable",
                        "type": "integer",
                        "minimum": 300,
                        "maximum": 864000,
                        "default": 172800
                    },
                    "condition": {
                        "description": "SMS will be sent if the condition specified is true after the specified amount of time",
                        "type": "string",
                        "enum": [
                            "undelivered",
                            "unread"
                        ],
                        "default": "undelivered"
                    },
                    "text": {
                        "description": "Text of the message (characters [,\\,],^,{,|,},~,\u20ac are long 2)",
                        "type": "string",
                        "maxLength": 1530,
                        "pattern": "^[\\u0020-\\u007E\u00a3\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\\r\u00d8\u00f8\n\u00c5\u00e5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\\u001B\u00c6\u00e6\u00df\u00c9 \u00a4\u00a1\u00c4\u00d6\u00d1\u00dc\u00a7\u00bf\u00e4\u00f6\u00f1\u00fc\u00e0\\u000C\u20ac]*$"
                    },
                    "senderNumber": {
                        "description": "Allows to specify any phone number you want as sender ID, the number must be in international format without + or 00, e.g.: 393334455666",
                        "type": "string",
                        "pattern": "^[0-9]*$"
                    },
                    "senderString": {
                        "description": "Allows to specify an alphanumeric string of maximum 11 characters to use as sender name",
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9 .]{0,11}$"
                    }
                }
            }
        },
        "required": [
            "mobileAppId",
            "text",
            "recipients"
        ],
        "defaultProperties": [
            "mobileAppId",
            "text",
            "recipients"
        ]
    }
    
    Examples:

    {
        "mobileAppId": 2,
        "text": "lorem ipsum dolor",
        "recipients": [
            {
                "identifier": "johndoe",
                "recipientRef": "testreference-johndoe"
            }
        ],
        "notificationText": "notification message",
        "messageRef": "testreference",
        "devicesData": {
            "ios": {
                "sound": false,
                "badge": 2,
                "soundPath": "folder/sound.mp3",
                "category": "test",
                "customData": {
                    "exampleKey": "exampleValue"
                }
            },
            "android": {
                "title": "test"
            }
        },
        "notifyCallback": {
            "method": "post",
            "url": "http://yoursite/notify-callback"
        }
    }
    

    Responses

    201 - Message created correctly

    Content-type: application/json
    Schema:
    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "Message",
        "description": "Message to be sent to a User",
        "type": "object",
        "properties": {
            "messageId": {
                "description": "Unique identifier of the message",
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{5,50}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "mobileAppId": {
                "description": "Unique identifier of the mobile app",
                "type": "integer"
            },
            "text": {
                "description": "Text of the message",
                "type": "string",
                "minLength": 1,
                "maxLength": 32768,
                "charset": "safe"
            },
            "recipients": {
                "title": "Define message recipients",
                "type": "array",
                "minItems": 1,
                "items": {
                    "title": "Recipient",
                    "type": "object",
                    "properties": {
                        "identifier": {
                            "description": "Identifier of the recipient (can be a phonenumber or the username used to login in the app)",
                            "type": "string",
                            "pattern": "^[!-~]{1,100}$"
                        },
                        "recipientRef": {
                            "description": "Custom identifier of the single dispatch to the recipient, expecially useful to track status",
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9._-]{5,100}$",
                            "charset": "safe"
                        },
                        "override": {
                            "title": "Override some parameters for the recipient",
                            "type": "object",
                            "properties": {
                                "text": {
                                    "description": "Override normal text for the recipient",
                                    "type": "string",
                                    "maxLength": 32768,
                                    "charset": "safe"
                                },
                                "mobileNumber": {
                                    "description": "Recipient number (international format without + or 00) used to send the SMS Fallback. By default the recipient identifier is used",
                                    "type": "string",
                                    "pattern": "^[0-9]{8,}$"
                                }
                            }
                        }
                    },
                    "required": [
                        "identifier"
                    ],
                    "defaultProperties": [
                        "identifier"
                    ]
                },
                "uniqueItems": true
            },
            "notificationText": {
                "description": "Text shown as the notification message from the device (in the notification bar). If not present, text is used",
                "type": "string",
                "minLength": 1,
                "maxLength": 400,
                "charset": "safe"
            },
            "messageRef": {
                "description": "Custom identifier of the message",
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{5,50}$",
                "charset": "safe"
            },
            "expireTime": {
                "description": "Seconds after creation after which the message is discarded if still undelivered (by default 2 days)",
                "type": "integer",
                "minimum": 1,
                "maximum": 2592000,
                "default": 172800
            },
            "isMarketing": {
                "description": "Set if the message is a marketing message",
                "type": "boolean",
                "default": false
            },
            "devicesData": {
                "title": "Push options for every device type",
                "type": "object",
                "properties": {
                    "ios": {
                        "title": "IOS devices",
                        "type": "object",
                        "properties": {
                            "sound": {
                                "description": "Play sound",
                                "type": "boolean",
                                "default": true
                            },
                            "badge": {
                                "description": "Badge number",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 2147483647,
                                "default": 0
                            },
                            "soundPath": {
                                "description": "Sound path (leave null for default)",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 32768
                            },
                            "category": {
                                "description": "Category used for custom actions",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 100
                            },
                            "customData": {
                                "description": "Custom object (see official Apple Documentation at http:\/\/apple.co\/1TXGePg for more details)",
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "default": null
                            }
                        }
                    },
                    "android": {
                        "title": "Android devices",
                        "type": "object",
                        "properties": {
                            "title": {
                                "description": "Title of the message",
                                "type": "string",
                                "maxLength": 400,
                                "charset": "safe"
                            }
                        }
                    }
                }
            },
            "notifyCallback": {
                "title": "Notify Callback",
                "description": "Endpoint used to receive notifications of message status changes, this can also be set on a per-app basis through the app panel",
                "type": "object",
                "properties": {
                    "url": {
                        "description": "Url used to send the callback",
                        "type": "string",
                        "format": "uri"
                    },
                    "method": {
                        "description": "Method used for the callback",
                        "type": "string",
                        "enum": [
                            "get",
                            "post"
                        ]
                    }
                },
                "required": [
                    "url",
                    "method"
                ]
            },
            "fallback": {
                "title": "SMS fallback",
                "description": "Enable the SMS fallback if condition is verified after a custom amount of time",
                "type": "object",
                "properties": {
                    "timeout": {
                        "description": "Seconds after which the message will be sent",
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 864000,
                        "default": 60
                    },
                    "validityPeriod": {
                        "description": "How many seconds the operator must retry to send the SMS in case of phone turned off or unreachable",
                        "type": "integer",
                        "minimum": 300,
                        "maximum": 864000,
                        "default": 172800
                    },
                    "condition": {
                        "description": "SMS will be sent if the condition specified is true after the specified amount of time",
                        "type": "string",
                        "enum": [
                            "undelivered",
                            "unread"
                        ],
                        "default": "undelivered"
                    },
                    "text": {
                        "description": "Text of the message (characters [,\\,],^,{,|,},~,\u20ac are long 2)",
                        "type": "string",
                        "maxLength": 1530,
                        "pattern": "^[\\u0020-\\u007E\u00a3\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\\r\u00d8\u00f8\n\u00c5\u00e5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\\u001B\u00c6\u00e6\u00df\u00c9 \u00a4\u00a1\u00c4\u00d6\u00d1\u00dc\u00a7\u00bf\u00e4\u00f6\u00f1\u00fc\u00e0\\u000C\u20ac]*$"
                    },
                    "senderNumber": {
                        "description": "Allows to specify any phone number you want as sender ID, the number must be in international format without + or 00, e.g.: 393334455666",
                        "type": "string",
                        "pattern": "^[0-9]*$"
                    },
                    "senderString": {
                        "description": "Allows to specify an alphanumeric string of maximum 11 characters to use as sender name",
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9 .]{0,11}$"
                    }
                }
            }
        },
        "required": [
            "messageId",
            "createdAt",
            "mobileAppId",
            "text",
            "recipients"
        ],
        "defaultProperties": [
            "mobileAppId",
            "text",
            "recipients"
        ]
    }

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "Message",
        "description": "Message to be sent to a User",
        "type": "object",
        "properties": {
            "messageId": {
                "description": "Unique identifier of the message",
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{5,50}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "mobileAppId": {
                "description": "Unique identifier of the mobile app",
                "type": "integer"
            },
            "text": {
                "description": "Text of the message",
                "type": "string",
                "minLength": 1,
                "maxLength": 32768,
                "charset": "safe"
            },
            "recipients": {
                "title": "Define message recipients",
                "type": "array",
                "minItems": 1,
                "items": {
                    "title": "Recipient",
                    "type": "object",
                    "properties": {
                        "identifier": {
                            "description": "Identifier of the recipient (can be a phonenumber or the username used to login in the app)",
                            "type": "string",
                            "pattern": "^[!-~]{1,100}$"
                        },
                        "recipientRef": {
                            "description": "Custom identifier of the single dispatch to the recipient, expecially useful to track status",
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9._-]{5,100}$",
                            "charset": "safe"
                        },
                        "override": {
                            "title": "Override some parameters for the recipient",
                            "type": "object",
                            "properties": {
                                "text": {
                                    "description": "Override normal text for the recipient",
                                    "type": "string",
                                    "maxLength": 32768,
                                    "charset": "safe"
                                },
                                "mobileNumber": {
                                    "description": "Recipient number (international format without + or 00) used to send the SMS Fallback. By default the recipient identifier is used",
                                    "type": "string",
                                    "pattern": "^[0-9]{8,}$"
                                }
                            }
                        }
                    },
                    "required": [
                        "identifier"
                    ],
                    "defaultProperties": [
                        "identifier"
                    ]
                },
                "uniqueItems": true
            },
            "notificationText": {
                "description": "Text shown as the notification message from the device (in the notification bar). If not present, text is used",
                "type": "string",
                "minLength": 1,
                "maxLength": 400,
                "charset": "safe"
            },
            "messageRef": {
                "description": "Custom identifier of the message",
                "type": "string",
                "pattern": "^[a-zA-Z0-9_-]{5,50}$",
                "charset": "safe"
            },
            "expireTime": {
                "description": "Seconds after creation after which the message is discarded if still undelivered (by default 2 days)",
                "type": "integer",
                "minimum": 1,
                "maximum": 2592000,
                "default": 172800
            },
            "isMarketing": {
                "description": "Set if the message is a marketing message",
                "type": "boolean",
                "default": false
            },
            "devicesData": {
                "title": "Push options for every device type",
                "type": "object",
                "properties": {
                    "ios": {
                        "title": "IOS devices",
                        "type": "object",
                        "properties": {
                            "sound": {
                                "description": "Play sound",
                                "type": "boolean",
                                "default": true
                            },
                            "badge": {
                                "description": "Badge number",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 2147483647,
                                "default": 0
                            },
                            "soundPath": {
                                "description": "Sound path (leave null for default)",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 32768
                            },
                            "category": {
                                "description": "Category used for custom actions",
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "default": null,
                                "maxLength": 100
                            },
                            "customData": {
                                "description": "Custom object (see official Apple Documentation at http:\/\/apple.co\/1TXGePg for more details)",
                                "type": [
                                    "object",
                                    "null"
                                ],
                                "default": null
                            }
                        }
                    },
                    "android": {
                        "title": "Android devices",
                        "type": "object",
                        "properties": {
                            "title": {
                                "description": "Title of the message",
                                "type": "string",
                                "maxLength": 400,
                                "charset": "safe"
                            }
                        }
                    }
                }
            },
            "notifyCallback": {
                "title": "Notify Callback",
                "description": "Endpoint used to receive notifications of message status changes, this can also be set on a per-app basis through the app panel",
                "type": "object",
                "properties": {
                    "url": {
                        "description": "Url used to send the callback",
                        "type": "string",
                        "format": "uri"
                    },
                    "method": {
                        "description": "Method used for the callback",
                        "type": "string",
                        "enum": [
                            "get",
                            "post"
                        ]
                    }
                },
                "required": [
                    "url",
                    "method"
                ]
            },
            "fallback": {
                "title": "SMS fallback",
                "description": "Enable the SMS fallback if condition is verified after a custom amount of time",
                "type": "object",
                "properties": {
                    "timeout": {
                        "description": "Seconds after which the message will be sent",
                        "type": "integer",
                        "minimum": 10,
                        "maximum": 864000,
                        "default": 60
                    },
                    "validityPeriod": {
                        "description": "How many seconds the operator must retry to send the SMS in case of phone turned off or unreachable",
                        "type": "integer",
                        "minimum": 300,
                        "maximum": 864000,
                        "default": 172800
                    },
                    "condition": {
                        "description": "SMS will be sent if the condition specified is true after the specified amount of time",
                        "type": "string",
                        "enum": [
                            "undelivered",
                            "unread"
                        ],
                        "default": "undelivered"
                    },
                    "text": {
                        "description": "Text of the message (characters [,\\,],^,{,|,},~,\u20ac are long 2)",
                        "type": "string",
                        "maxLength": 1530,
                        "pattern": "^[\\u0020-\\u007E\u00a3\u00a5\u00e8\u00e9\u00f9\u00ec\u00f2\u00c7\\r\u00d8\u00f8\n\u00c5\u00e5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\\u001B\u00c6\u00e6\u00df\u00c9 \u00a4\u00a1\u00c4\u00d6\u00d1\u00dc\u00a7\u00bf\u00e4\u00f6\u00f1\u00fc\u00e0\\u000C\u20ac]*$"
                    },
                    "senderNumber": {
                        "description": "Allows to specify any phone number you want as sender ID, the number must be in international format without + or 00, e.g.: 393334455666",
                        "type": "string",
                        "pattern": "^[0-9]*$"
                    },
                    "senderString": {
                        "description": "Allows to specify an alphanumeric string of maximum 11 characters to use as sender name",
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9 .]{0,11}$"
                    }
                }
            }
        },
        "required": [
            "messageId",
            "createdAt",
            "mobileAppId",
            "text",
            "recipients"
        ],
        "defaultProperties": [
            "mobileAppId",
            "text",
            "recipients"
        ]
    }
    
    Examples:

    {
        "messageId": "id-test-message",
        "createdAt": "2015-04-26T01:37:17Z",
        "mobileAppId": 2,
        "text": "lorem ipsum dolor",
        "recipients": [
            {
                "identifier": "johndoe",
                "recipientRef": "testreference-johndoe"
            }
        ],
        "notificationText": "notification message",
        "messageRef": "testreference",
        "devicesData": {
            "ios": {
                "sound": false,
                "badge": 2,
                "soundPath": "folder/sound.mp3",
                "category": "test",
                "customData": {
                    "exampleKey": "exampleValue"
                }
            },
            "android": {
                "title": "test"
            }
        },
        "notifyCallback": {
            "method": "post",
            "url": "http://yoursite/notify-callback"
        }
    }
    

    401 - Bad or expired token. This can happen if the user or Catapush revoked or expired an access token. To fix, you should re-authenticate the user.

    403 - Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…). Unfortunately, re-authenticating the user won’t help here.

    Send attachments

    It is possible to send a single attachment together with the message. The post request follows the rules of a web filled-in form (RFC 2388). Content-Type must be set to multipart/form-data. The json body seen previously must be sent as a parameter named metadata. The file must be sent as a parameter named file. A basic CURL example follows:

    curl --header 'authorization: Bearer ACCESS_TOKEN'
      --url http://api.catapush.com/1/messages
      -F "metadata={\"mobileAppId\":2,\"text\":\"lorem ipsum dolor\",\"recipients\":[{\"identifier\":\"johndoe\"}]}"
      -F "file=@image.jpg"
    

    The reply to this request follows same rules seen in the previous section.

    3 User

    Manage mobile users.

    3.1 GET - List users - filter,search

    Get user collection

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/apps/2/users/?page=1&size=10",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "authorization: Bearer ACCESS_TOKEN",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request GET \
      --url 'https://api.catapush.com/1/apps/2/users/?page=1&size=10' \
      --header 'accept: application/json' \
      --header 'authorization: Bearer ACCESS_TOKEN' \
      --header 'content-type: application/json'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.get("https://api.catapush.com/1/apps/2/users/?page=1&size=10")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .header("authorization", "Bearer ACCESS_TOKEN")
      .asString();
    
    var data = null;
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.catapush.com/1/apps/2/users/?page=1&size=10");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Bearer ACCESS_TOKEN");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "GET",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/apps/2/users/?page=1&size=10",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": "Bearer ACCESS_TOKEN"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/apps/2/users/?page=1&size=10");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "authorization: Bearer ACCESS_TOKEN");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/apps/2/users/?page=1&size=10");
    var request = new RestRequest(Method.GET);
    request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/apps/2/users/?page=1&size=10"
    
        req, _ := http.NewRequest("GET", url, nil)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
        req.Header.Add("authorization", "Bearer ACCESS_TOKEN")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/apps/2/users/?page=1&size=10")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Get.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer ACCESS_TOKEN'
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json",
        'authorization': "Bearer ACCESS_TOKEN"
        }
    
    conn.request("GET", "/1/apps/2/users/?page=1&size=10", headers=headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:appsUsersFetchAll>
             <idMobileApp>1</idMobileApp>
             <params>
                <page>0</page>
                <size>2</size>
             </params>
             <auth>
                <access_token>ACCESS_TOKEN</access_token>
             </auth>
          </soap:appsUsersFetchAll>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:appsUsersFetchAllResponse>
             <appsUsersFetchAllResult>
                <items>
                   <SOAP-ENC:Struct>
                      <platform>iOS</platform>
                      <createdAt>2014-04-28T09:40:00+0200</createdAt>
                      <identifier>johndoe</identifier>
                   </SOAP-ENC:Struct>
                   <SOAP-ENC:Struct>
                      <platform>iOS</platform>
                      <createdAt>2014-04-28T09:23:00+0200</createdAt>
                      <identifier>foo</identifier>
                   </SOAP-ENC:Struct>
                </items>
                <totalCount>4</totalCount>
             </appsUsersFetchAllResult>
          </ns1:appsUsersFetchAllResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    HTTP Request

    GET https://api.catapush.com/1/apps/{appId}/users

    Query Parameters

    ParameterRequiredDefaultDescription
    pagefalseThe page of results to return
    sizefalseThe number of results to return
    access_tokenfalseUsed to send a valid access token. Do not use together with the “Authorization” header

    Responses

    200 - User list

    Content-type: application/json
    Schema:
    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User Set",
        "type": "object",
        "properties": {
            "total_count": {
                "id": "http:\/\/jsonschema.net\/total_count",
                "type": "integer"
            },
            "_embedded": {
                "type": "object",
                "properties": {
                    "AppUser": {
                        "type": "array",
                        "items": {
                            "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
                            "id": "#user",
                            "title": "User",
                            "description": "Mobile User",
                            "type": "object",
                            "properties": {
                                "identifier": {
                                    "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                                    "type": "string",
                                    "pattern": "^[!-~]{1,100}$"
                                },
                                "createdAt": {
                                    "description": "Creation datetime (rfc-3339)",
                                    "type": "string",
                                    "format": "date-time"
                                },
                                "platform": {
                                    "description": "Device OS",
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "enum": [
                                        "Android",
                                        "iOS",
                                        null
                                    ]
                                }
                            },
                            "required": [
                                "identifier",
                                "createdAt",
                                "platform"
                            ]
                        }
                    }
                }
            }
        },
        "required": [
            "total_count",
            "_embedded"
        ]
    }

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User Set",
        "type": "object",
        "properties": {
            "total_count": {
                "id": "http:\/\/jsonschema.net\/total_count",
                "type": "integer"
            },
            "_embedded": {
                "type": "object",
                "properties": {
                    "AppUser": {
                        "type": "array",
                        "items": {
                            "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
                            "id": "#user",
                            "title": "User",
                            "description": "Mobile User",
                            "type": "object",
                            "properties": {
                                "identifier": {
                                    "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                                    "type": "string",
                                    "pattern": "^[!-~]{1,100}$"
                                },
                                "createdAt": {
                                    "description": "Creation datetime (rfc-3339)",
                                    "type": "string",
                                    "format": "date-time"
                                },
                                "platform": {
                                    "description": "Device OS",
                                    "type": [
                                        "string",
                                        "null"
                                    ],
                                    "enum": [
                                        "Android",
                                        "iOS",
                                        null
                                    ]
                                }
                            },
                            "required": [
                                "identifier",
                                "createdAt",
                                "platform"
                            ]
                        }
                    }
                }
            }
        },
        "required": [
            "total_count",
            "_embedded"
        ]
    }
    
    Examples:

    {
        "total_count": 4,
        "_embedded": {
            "AppUser": [
                {
                    "createdAt": "2015-07-22T13:13:53+0200",
                    "identifier": "johndoe",
                    "platform": null
                },
                {
                    "createdAt": "2015-07-22T13:13:53+0200",
                    "identifier": "foo",
                    "platform": null
                }
            ]
        }
    }
    

    401 - Bad or expired token. This can happen if the user or Catapush revoked or expired an access token. To fix, you should re-authenticate the user.

    403 - Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…). Unfortunately, re-authenticating the user won’t help here.

    3.2 POST - Create a new user

    Create a user

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/apps/2/users",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "POST",
      CURLOPT_POSTFIELDS => "{ \"identifier\":\"johndoe\", \"password\":\"johnd0e56_a\" }",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "authorization: Bearer ACCESS_TOKEN",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request POST \
      --url https://api.catapush.com/1/apps/2/users \
      --header 'accept: application/json' \
      --header 'authorization: Bearer ACCESS_TOKEN' \
      --header 'content-type: application/json' \
      --data '{ "identifier":"johndoe", "password":"johnd0e56_a" }'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.post("https://api.catapush.com/1/apps/2/users")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .header("authorization", "Bearer ACCESS_TOKEN")
      .body("{ \"identifier\":\"johndoe\", \"password\":\"johnd0e56_a\" }")
      .asString();
    
    var data = JSON.stringify({
      "identifier": "johndoe",
      "password": "johnd0e56_a"
    });
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("POST", "https://api.catapush.com/1/apps/2/users");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Bearer ACCESS_TOKEN");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "POST",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/apps/2/users",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": "Bearer ACCESS_TOKEN"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(JSON.stringify({ identifier: 'johndoe', password: 'johnd0e56_a' }));
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/apps/2/users");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "authorization: Bearer ACCESS_TOKEN");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"identifier\":\"johndoe\", \"password\":\"johnd0e56_a\" }");
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/apps/2/users");
    var request = new RestRequest(Method.POST);
    request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    request.AddParameter("application/json", "{ \"identifier\":\"johndoe\", \"password\":\"johnd0e56_a\" }", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "strings"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/apps/2/users"
    
        payload := strings.NewReader("{ \"identifier\":\"johndoe\", \"password\":\"johnd0e56_a\" }")
    
        req, _ := http.NewRequest("POST", url, payload)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
        req.Header.Add("authorization", "Bearer ACCESS_TOKEN")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/apps/2/users")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Post.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer ACCESS_TOKEN'
    request.body = "{ \"identifier\":\"johndoe\", \"password\":\"johnd0e56_a\" }"
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    payload = "{ \"identifier\":\"johndoe\", \"password\":\"johnd0e56_a\" }"
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json",
        'authorization': "Bearer ACCESS_TOKEN"
        }
    
    conn.request("POST", "/1/apps/2/users", payload, headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:appsUsersCreate>
             <idMobileApp>1</idMobileApp>
             <data>
                <identifier>johndoe</identifier>
                <password>johnd0e56_a</password>
             </data>
             <auth>
                <access_token>ACCESS_TOKEN</access_token>
             </auth>
          </soap:appsUsersCreate>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:appsUsersCreateResponse>
             <appsUsersCreateResult>
                <platform xsi:nil="true"/>
                <createdAt>2015-07-22T15:13:04+0200</createdAt>
                <identifier>johndoe</identifier>
             </appsUsersCreateResult>
          </ns1:appsUsersCreateResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    HTTP Request

    POST https://api.catapush.com/1/apps/{appId}/users

    Query Parameters

    ParameterRequiredDefaultDescription
    access_tokenfalseUsed to send a valid access token. Do not use together with the “Authorization” header

    Body

    Content-type: application/json

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "password": {
                "description": "User password",
                "type": "string",
                "pattern": "^[a-zA-Z0-9\\+\\-\\*_@]{3,20}$"
            }
        },
        "required": [
            "identifier",
            "password"
        ]
    }
    Schema:

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "password": {
                "description": "User password",
                "type": "string",
                "pattern": "^[a-zA-Z0-9\\+\\-\\*_@]{3,20}$"
            }
        },
        "required": [
            "identifier",
            "password"
        ]
    }
    
    Examples:

    {
        "identifier": "johndoe",
        "password": "johnd0e56_a"
    }
    

    Responses

    201 - User created correctly

    Content-type: application/json
    Schema:
    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "platform": {
                "description": "Device OS",
                "type": [
                    "string",
                    "null"
                ],
                "enum": [
                    "Android",
                    "iOS",
                    null
                ]
            }
        },
        "required": [
            "identifier",
            "createdAt",
            "platform"
        ]
    }

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "platform": {
                "description": "Device OS",
                "type": [
                    "string",
                    "null"
                ],
                "enum": [
                    "Android",
                    "iOS",
                    null
                ]
            }
        },
        "required": [
            "identifier",
            "createdAt",
            "platform"
        ]
    }
    
    Examples:

    {
        "identifier": "johndoe",
        "createdAt": "2015-07-22T13:13:53+0200",
        "platform": null
    }
    

    401 - Bad or expired token. This can happen if the user or Catapush revoked or expired an access token. To fix, you should re-authenticate the user.

    403 - Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…). Unfortunately, re-authenticating the user won’t help here.

    3.3 User Entity

    Manage an existing user entity.

    3.3.1 GET - Get user

    Get a user

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/apps/2/users/johndoe",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "GET",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "authorization: Bearer ACCESS_TOKEN",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request GET \
      --url https://api.catapush.com/1/apps/2/users/johndoe \
      --header 'accept: application/json' \
      --header 'authorization: Bearer ACCESS_TOKEN' \
      --header 'content-type: application/json'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.get("https://api.catapush.com/1/apps/2/users/johndoe")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .header("authorization", "Bearer ACCESS_TOKEN")
      .asString();
    
    var data = null;
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "https://api.catapush.com/1/apps/2/users/johndoe");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Bearer ACCESS_TOKEN");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "GET",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/apps/2/users/johndoe",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": "Bearer ACCESS_TOKEN"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/apps/2/users/johndoe");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "authorization: Bearer ACCESS_TOKEN");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/apps/2/users/johndoe");
    var request = new RestRequest(Method.GET);
    request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/apps/2/users/johndoe"
    
        req, _ := http.NewRequest("GET", url, nil)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
        req.Header.Add("authorization", "Bearer ACCESS_TOKEN")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/apps/2/users/johndoe")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Get.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer ACCESS_TOKEN'
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json",
        'authorization': "Bearer ACCESS_TOKEN"
        }
    
    conn.request("GET", "/1/apps/2/users/johndoe", headers=headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:appsUsersFetch>
             <idMobileApp>1</idMobileApp>
             <identifier>johndoe</identifier>
             <auth>
                <access_token>ACCESS_TOKEN</access_token>
             </auth>
          </soap:appsUsersFetch>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:appsUsersFetchResponse>
             <appsUsersFetchResult>
                <platform>Android</platform>
                <createdAt>2014-04-28T09:23:00+0200</createdAt>
                <identifier>johndoe</identifier>
             </appsUsersFetchResult>
          </ns1:appsUsersFetchResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    HTTP Request

    GET https://api.catapush.com/1/apps/{appId}/users/{identifier}

    Query Parameters

    ParameterRequiredDefaultDescription
    access_tokenfalseUsed to send a valid access token. Do not use together with the “Authorization” header

    Responses

    200 - User entity

    Content-type: application/json
    Schema:
    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "platform": {
                "description": "Device OS",
                "type": [
                    "string",
                    "null"
                ],
                "enum": [
                    "Android",
                    "iOS",
                    null
                ]
            }
        },
        "required": [
            "identifier",
            "createdAt",
            "platform"
        ]
    }

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "platform": {
                "description": "Device OS",
                "type": [
                    "string",
                    "null"
                ],
                "enum": [
                    "Android",
                    "iOS",
                    null
                ]
            }
        },
        "required": [
            "identifier",
            "createdAt",
            "platform"
        ]
    }
    
    Examples:

    {
        "identifier": "johndoe",
        "createdAt": "2015-07-22T13:13:53+0200",
        "platform": null
    }
    

    401 - Bad or expired token. This can happen if the user or Catapush revoked or expired an access token. To fix, you should re-authenticate the user.

    403 - Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…). Unfortunately, re-authenticating the user won’t help here.

    3.3.2 PATCH - Modify user

    Modify a user

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/apps/2/users",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "PATCH",
      CURLOPT_POSTFIELDS => "{ \"password\":\"johnd0e56_abc\" }",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "authorization: Bearer ACCESS_TOKEN",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request PATCH \
      --url https://api.catapush.com/1/apps/2/users \
      --header 'accept: application/json' \
      --header 'authorization: Bearer ACCESS_TOKEN' \
      --header 'content-type: application/json' \
      --data '{ "password":"johnd0e56_abc" }'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.patch("https://api.catapush.com/1/apps/2/users")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .header("authorization", "Bearer ACCESS_TOKEN")
      .body("{ \"password\":\"johnd0e56_abc\" }")
      .asString();
    
    var data = JSON.stringify({
      "password": "johnd0e56_abc"
    });
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("PATCH", "https://api.catapush.com/1/apps/2/users");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Bearer ACCESS_TOKEN");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "PATCH",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/apps/2/users",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": "Bearer ACCESS_TOKEN"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.write(JSON.stringify({ password: 'johnd0e56_abc' }));
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/apps/2/users");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "authorization: Bearer ACCESS_TOKEN");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"password\":\"johnd0e56_abc\" }");
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/apps/2/users");
    var request = new RestRequest(Method.PATCH);
    request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    request.AddParameter("application/json", "{ \"password\":\"johnd0e56_abc\" }", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "strings"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/apps/2/users"
    
        payload := strings.NewReader("{ \"password\":\"johnd0e56_abc\" }")
    
        req, _ := http.NewRequest("PATCH", url, payload)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
        req.Header.Add("authorization", "Bearer ACCESS_TOKEN")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/apps/2/users")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Patch.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer ACCESS_TOKEN'
    request.body = "{ \"password\":\"johnd0e56_abc\" }"
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    payload = "{ \"password\":\"johnd0e56_abc\" }"
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json",
        'authorization': "Bearer ACCESS_TOKEN"
        }
    
    conn.request("PATCH", "/1/apps/2/users", payload, headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:appsUsersPatch>
             <idMobileApp>1</idMobileApp>
             <identifier>johndoe</identifier>
             <data>
                <identifier>johndoe</identifier>
                <password>newpwd</password>
             </data>
             <auth>
                <access_token>ACCESS_TOKEN</access_token>
             </auth>
          </soap:appsUsersPatch>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:appsUsersPatchResponse>
             <appsUsersPatchResult>
                <platform>iOS</platform>
                <createdAt>2014-04-28T09:40:00+0200</createdAt>
                <identifier>johndoe</identifier>
             </appsUsersPatchResult>
          </ns1:appsUsersPatchResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    HTTP Request

    PATCH https://api.catapush.com/1/apps/{appId}/users/{identifier}

    Query Parameters

    ParameterRequiredDefaultDescription
    access_tokenfalseUsed to send a valid access token. Do not use together with the “Authorization” header

    Body

    Content-type: application/json

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "Patch User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "password": {
                "description": "User password",
                "type": "string",
                "pattern": "^[a-zA-Z0-9\\+\\-\\*_@]{3,20}$"
            }
        }
    }
    Schema:

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "Patch User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "password": {
                "description": "User password",
                "type": "string",
                "pattern": "^[a-zA-Z0-9\\+\\-\\*_@]{3,20}$"
            }
        }
    }
    
    Examples:

    {
        "password": "johnd0e56_abc"
    }
    

    Responses

    200 - User modified correctly

    Content-type: application/json
    Schema:
    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "platform": {
                "description": "Device OS",
                "type": [
                    "string",
                    "null"
                ],
                "enum": [
                    "Android",
                    "iOS",
                    null
                ]
            }
        },
        "required": [
            "identifier",
            "createdAt",
            "platform"
        ]
    }

    {
        "$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
        "title": "User",
        "description": "Mobile User",
        "type": "object",
        "properties": {
            "identifier": {
                "description": "User identifier (can be a phonenumber or the username used to login in the app)",
                "type": "string",
                "pattern": "^[!-~]{1,100}$"
            },
            "createdAt": {
                "description": "Creation datetime (rfc-3339)",
                "type": "string",
                "format": "date-time"
            },
            "platform": {
                "description": "Device OS",
                "type": [
                    "string",
                    "null"
                ],
                "enum": [
                    "Android",
                    "iOS",
                    null
                ]
            }
        },
        "required": [
            "identifier",
            "createdAt",
            "platform"
        ]
    }
    
    Examples:

    {
        "identifier": "johndoe",
        "createdAt": "2015-07-22T13:13:53+0200",
        "platform": null
    }
    

    401 - Bad or expired token. This can happen if the user or Catapush revoked or expired an access token. To fix, you should re-authenticate the user.

    403 - Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…). Unfortunately, re-authenticating the user won’t help here.

    3.3.3 DELETE - Delete user

    Delete a user

    <?php
    // Requirement: Client URL Library (see http://php.net/manual/en/book.curl.php)
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => "https://api.catapush.com/1/apps/2/users/johndoe",
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => "",
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 30,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => "DELETE",
      CURLOPT_HTTPHEADER => array(
        "Expect:",
        "accept: application/json",
        "authorization: Bearer ACCESS_TOKEN",
        "content-type: application/json"
      ),
    ));
    
    $response = curl_exec($curl);
    $err = curl_error($curl);
    
    curl_close($curl);
    
    if ($err) {
      echo "cURL Error #:" . $err;
    } else {
      echo $response;
    }
    
    curl --request DELETE \
      --url https://api.catapush.com/1/apps/2/users/johndoe \
      --header 'accept: application/json' \
      --header 'authorization: Bearer ACCESS_TOKEN' \
      --header 'content-type: application/json'
    
    // Requirement: Unirest Library (see http://unirest.io/java.html)
    HttpResponse<String> response = Unirest.delete("https://api.catapush.com/1/apps/2/users/johndoe")
      .header("accept", "application/json")
      .header("content-type", "application/json")
      .header("authorization", "Bearer ACCESS_TOKEN")
      .asString();
    
    var data = null;
    
    var xhr = new XMLHttpRequest();
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === this.DONE) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("DELETE", "https://api.catapush.com/1/apps/2/users/johndoe");
    xhr.setRequestHeader("accept", "application/json");
    xhr.setRequestHeader("content-type", "application/json");
    xhr.setRequestHeader("authorization", "Bearer ACCESS_TOKEN");
    
    xhr.send(data);
    
    var http = require("https");
    
    var options = {
      "method": "DELETE",
      "hostname": "api.catapush.com",
      "port": null,
      "path": "/1/apps/2/users/johndoe",
      "headers": {
        "accept": "application/json",
        "content-type": "application/json",
        "authorization": "Bearer ACCESS_TOKEN"
      }
    };
    
    var req = http.request(options, function (res) {
      var chunks = [];
    
      res.on("data", function (chunk) {
        chunks.push(chunk);
      });
    
      res.on("end", function () {
        var body = Buffer.concat(chunks);
        console.log(body.toString());
      });
    });
    
    req.end();
    
    /* Requirement: libcurl library (see https://curl.haxx.se/libcurl/) */
    CURL *hnd = curl_easy_init();
    
    curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
    curl_easy_setopt(hnd, CURLOPT_URL, "https://api.catapush.com/1/apps/2/users/johndoe");
    
    struct curl_slist *headers = NULL;
    headers = curl_slist_append(headers, "authorization: Bearer ACCESS_TOKEN");
    headers = curl_slist_append(headers, "content-type: application/json");
    headers = curl_slist_append(headers, "accept: application/json");
    curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
    
    CURLcode ret = curl_easy_perform(hnd);
    
    /* Requirement: RestSharp library (see http://restsharp.org/) */
    var client = new RestClient("https://api.catapush.com/1/apps/2/users/johndoe");
    var request = new RestRequest(Method.DELETE);
    request.AddHeader("authorization", "Bearer ACCESS_TOKEN");
    request.AddHeader("content-type", "application/json");
    request.AddHeader("accept", "application/json");
    IRestResponse response = client.Execute(request);
    
    package main
    
    import (
        "fmt"
        "net/http"
        "io/ioutil"
    )
    
    func main() {
    
        url := "https://api.catapush.com/1/apps/2/users/johndoe"
    
        req, _ := http.NewRequest("DELETE", url, nil)
    
        req.Header.Add("accept", "application/json")
        req.Header.Add("content-type", "application/json")
        req.Header.Add("authorization", "Bearer ACCESS_TOKEN")
    
        res, _ := http.DefaultClient.Do(req)
    
        defer res.Body.Close()
        body, _ := ioutil.ReadAll(res.Body)
    
        fmt.Println(res)
        fmt.Println(string(body))
    
    }
    
    require 'uri'
    require 'net/http'
    
    url = URI("https://api.catapush.com/1/apps/2/users/johndoe")
    
    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    
    request = Net::HTTP::Delete.new(url)
    request["accept"] = 'application/json'
    request["content-type"] = 'application/json'
    request["authorization"] = 'Bearer ACCESS_TOKEN'
    
    response = http.request(request)
    puts response.read_body
    
    # Requirement: Python3 HTTP Client library (see https://docs.python.org/3/library/http.client.html)
    import http.client
    
    conn = http.client.HTTPSConnection("api.catapush.com")
    
    headers = {
        'accept': "application/json",
        'content-type': "application/json",
        'authorization': "Bearer ACCESS_TOKEN"
        }
    
    conn.request("DELETE", "/1/apps/2/users/johndoe", headers=headers)
    
    res = conn.getresponse()
    data = res.read()
    
    print(data.decode("utf-8"))
    
    Request:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <soapenv:Header/>
       <soapenv:Body>
          <soap:appsUsersDelete>
             <idMobileApp>1</idMobileApp>
             <identifier>johndoe</identifier>
             <auth>
                <access_token>ACCESS_TOKEN</access_token>
             </auth>
          </soap:appsUsersDelete>
       </soapenv:Body>
    </soapenv:Envelope>
    
    Response:
    <SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="https://api.catapush.com/soap/">
       <SOAP-ENV:Body>
          <ns1:appsUsersDeleteResponse>
             <appsUsersDeleteResult>true</appsUsersDeleteResult>
          </ns1:appsUsersDeleteResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    HTTP Request

    DELETE https://api.catapush.com/1/apps/{appId}/users/{identifier}

    Query Parameters

    ParameterRequiredDefaultDescription
    access_tokenfalseUsed to send a valid access token. Do not use together with the “Authorization” header

    Responses

    204 - User deleted correctly

    401 - Bad or expired token. This can happen if the user or Catapush revoked or expired an access token. To fix, you should re-authenticate the user.

    403 - Bad OAuth request (wrong consumer key, bad nonce, expired timestamp…). Unfortunately, re-authenticating the user won’t help here.

    API Examples of use

    This column contains examples of URL, requests and replies.

    Copy and paste code examples for our APIs and get ready to start sending push notifications immediately!