curl \ -X POST \ -H 'Authorization: Bearer TURBO_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "interval":"this_month" }' \ https://api.tur.bo/report/paymenttimeelapsed<?php /* For this request to work please install guzzlehttp: curl -sS https://getcomposer.org/installer | php ./composer.phar require guzzlehttp/guzzle:^7.0 */ require 'vendor/autoload.php'; $api_url ='https://api.tur.bo'; $api_path='/report/paymenttimeelapsed'; $api_key ='TURBO_API_KEY'; $opts =[ 'json'=>[ 'interval'=>'this_month' ] ]; $headers =array( 'Authorization'=>'Bearer '.$api_key, 'Content-Type' =>'application/json' ); try { $client=new GuzzleHttp\Client( array( 'headers'=> $headers ) ); $json =$client->post( $api_url.$api_path, $opts )->getBody()->getContents(); echo $json; } catch( Exception $e ) { echo 'error = ',$e->getMessage(),"\n"; } ?>#!/usr/bin/python import requests import json api_url="https://api.tur.bo/report/paymenttimeelapsed" result=requests.post( api_url,json={ 'interval':'this_month' },headers={'Authorization':'Bearer TURBO_API_KEY','Content-Type':'application/json'} ) print( json.dumps( result.json() ) )#!/usr/bin/env ruby require 'uri' require 'net/http' require 'net/https' require 'json' api_url ="https://api.tur.bo/report/paymenttimeelapsed" api_key ='TURBO_API_KEY' uri =URI( api_url ) opts ={ 'interval':'this_month' } http =Net::HTTP.new( uri.host,uri.port ) http.use_ssl=true headers ={ 'Authorization'=>"Bearer #{api_key}", 'Content-Type' =>'application/json' } result=http.post( uri.path,opts.to_json,headers ) puts result.body
Response{ "error":false, "msg":"OK", "period": { "interval":"this_month" }, "api_path":"/paymenttimeelapsed", "total_results":null, "limit":25, "report_url": "https://api.tur.bo/pdf/example.pdf", }
| JSON response object | |
|---|---|
| Key | Value |
| error | true or false depending on if an error has occurred in the API request |
| msg | OK if all is well, otherwise will include descriptive error text |
| type | report |
| start | a timestamp in mm/dd/YYYY format. view all payments beginning from this date. end can be used in conjunction with this to create a custom date range |
| end | a timestamp in mm/dd/YYYY format. view all payments up to this date. start can be used in conjunction with this to create a custom date range |
| interval |
use interval to quickly view results using a friendly label. the currently supported labels are: today, yesterday, this_week, this_month, this_year, last_week, last_month, and last_year |
| total_results | total number of all results found |
| limit | number of results currently displayed |
| report_url | URL where the created PDF can be downloaded |