Tips for working with our API

SUMMARY

Baby steps pay big dividends when dealing with APIs. So, stay patient without overtaxing yourself. For example, start with:

After learning to make successful API calls through the above options, attempt to write your own code. An extension can help you troubleshoot by separating client-code bugs from network issues.

Use PHP exception handling to see actual error messages, like this:

try{
        $surl = $client->shorten($url, $data);
}catch(\Exception $e){
        print $e->getMessage();
}

Set Content-Type header for HTTP requests. So headers part would look like this:

    headers: {
        'Authorization': 'Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
        'Content-Type': 'application/json',
        'Content-Length': message.length
    }