curl \
-X POST \
-H 'Authorization: Bearer TURBO_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "first_name":"Bob","last_name":"Bobberino","email":"[email protected]","phone":"0000000000" }' \
https://api.tur.bo/customers/add
<?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='/customers/add';
$api_key ='TURBO_API_KEY';
$opts =[ 'json'=>[ 'first_name'=>'Bob','last_name'=>'Bobberino','email'=>'[email protected]','phone'=>'0000000000' ] ];
$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/customers/add"
result=requests.post( api_url,json={ 'first_name':'Bob','last_name':'Bobberson' },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/customers/add"
api_key ='TURBO_API_KEY'
uri =URI( api_url )
opts ={ 'first_name':'Bob','last_name':'Bobberson' }
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
{
"error": false,
"msg": "OK",
"api_path": "/customers/add",
"customer": [ {
"id": "123",
"first_name": "bob",
"last_name": "bobby",
"email": "[email protected]",
"phone": "(123) 123-1231",
"street_address": "bob's street",
"unit": "1",
"city": "Denver",
"state": "CO",
"zip": "80201",
"notes": "account ID xyz"
} ]
}
| 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 |
customers/add |
| customer[] |
newly created customer |
| customer.id |
customer ID |
| customer.first_name |
first name |
| customer.last_name |
last name |
| customer.email |
email address |
| customer.phone |
phone number |
| customer.street_address |
street address |
| customer.unit |
apartment, unit, suite |
| customer.city |
city |
| customer.state |
state |
| customer.zip |
zip code |
| customer.notes |
field to store notes about this customer |