SDK & General Information


The current SDK is for PHP. Please inquire about SDKs for other mainstream languages.


We take data security seriously! All data is transferred via HTTPS and requests are signed using a private key.


We accept 3 types of communication: GET, POST and JSON POST. If you want to use the last one, please remember to add [Content-Type: application/json] header, and to use json as a POST body content.


Below is a simple PHP class for making API calls:

<?php

class GatherUpSimpleApi {
    const URL = 'https://app.gatherup.com/api';
    const TIMEOUT = 30; // 30 seconds timeout

    /**
     * Init
     * 
     * @param string $clientId
     * @param string $privateKey
     */
    public function __construct($clientId, $privateKey) {
        $this->clientId = $clientId;
        $this->privateKey = $privateKey;
    }

    /**
     * Do HTTP API request
     * 
     * @param string $resource
     * @param array[string] $request
     * 
     * @return string JSON response
     */
    public function doRequest($resource, $request) {
        $request['clientId'] = $this->clientId;
        $request['hash'] = $this->signRequest($request, $this->privateKey);
        return $this->doJsonPost($resource, $request);
    }

    /**
     * JSON POST HTTP request
     * 
     * @param string $resource
     * @param array[string] $request
     * 
     * @return string JSON response
     */
    protected function doJsonPost($resource, $request) {
        $ch = curl_init(self::URL . $resource);

        curl_setopt_array($ch, array(
            CURLOPT_POST => TRUE,
            CURLOPT_RETURNTRANSFER => TRUE,
            CURLOPT_TIMEOUT => self::TIMEOUT,
            CURLOPT_HTTPHEADER => array(
                'Content-Type: application/json'
            ),
            CURLOPT_POSTFIELDS => json_encode($request)
        ));

        return curl_exec($ch);
    }

    /**
     * Sign request with private key
     * 
     * @param array[string] $request
     * @param string $privateKey
     * 
     * @return string Hash sign
     */
    protected function signRequest($request, $privateKey) {
        ksort($request);

        $control = $privateKey;
        foreach ($request as $key => $value) {
            $control .= $key . $value;
        }

        return hash('sha256', $control);
    }

}

And an example how to use it (Please review https://userguide.gatherup.com/knowledge-base/gatherup-api-client-key-and-business-id on how to find your clientId and privateKey)::

<?php

$privateKey = 'ea480aeb30a44e7ba85448619f9a6a94775b35d5886d4ce52dd452efb414406e';
$clientId = '04f78076fbfc66940169d2199af7c6698019f9f3';

$api = new GatherUpSimpleApi($clientId, $privateKey);
$response = json_decode($api->doRequest('/test', array()));
print_r($response);

Limit: 5 requests per second. Everything above this limit will return 503 HTTP error.