Perl / New FreshBooks / Register as a new user
Back to Collection Items
use chilkat();
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
$http = chilkat::CkHttp->new();
# Use this online tool to generate code from sample JSON: Generate Code to Create JSON
# The following JSON is sent in the request body.
# {
# "id": "api.freshbooks@gmail.com",
# "company_name": null,
# "email": "api.freshbooks@gmail.com",
# "password": "jjjjjjjjjjjjjjjjjjj",
# "country": "Canada",
# "currencyCode": "CAD",
# "access_token": null,
# "direct_buy": false,
# "skip_system": false,
# "skip_business": false,
# "send_confirmation_notification": true,
# "capacity": null,
# "provisioner": "magnum",
# "referring_url": null,
# "landing_url": null,
# "referralid": null,
# "web_promo": null,
# "visitor_id": null,
# "optimizely_user_id": "oeu1556551964423r0.989078205100306",
# "optimizely_buckets": null
# }
$json = chilkat::CkJsonObject->new();
$json->UpdateString("id",'api.freshbooks@gmail.com');
$json->UpdateNull("company_name");
$json->UpdateString("email",'api.freshbooks@gmail.com');
$json->UpdateString("password","jjjjjjjjjjjjjjjjjjj");
$json->UpdateString("country","Canada");
$json->UpdateString("currencyCode","CAD");
$json->UpdateNull("access_token");
$json->UpdateBool("direct_buy",0);
$json->UpdateBool("skip_system",0);
$json->UpdateBool("skip_business",0);
$json->UpdateBool("send_confirmation_notification",1);
$json->UpdateNull("capacity");
$json->UpdateString("provisioner","magnum");
$json->UpdateNull("referring_url");
$json->UpdateNull("landing_url");
$json->UpdateNull("referralid");
$json->UpdateNull("web_promo");
$json->UpdateNull("visitor_id");
$json->UpdateString("optimizely_user_id","oeu1556551964423r0.989078205100306");
$json->UpdateNull("optimizely_buckets");
$http->SetRequestHeader("Content-Type","application/json");
# resp is a HttpResponse
$resp = $http->PostJson3("https://api.freshbooks.com/auth/api/v1/smux/registrations","application/json",$json);
if ($http->get_LastMethodSuccess() == 0) {
print $http->lastErrorText() . "\r\n";
exit;
}
print $resp->get_StatusCode() . "\r\n";
print $resp->bodyStr() . "\r\n";
Curl Command
curl -X POST
-H "Content-Type: application/json"
-d '{
"id": "api.freshbooks@gmail.com",
"company_name": null,
"email": "api.freshbooks@gmail.com",
"password": "jjjjjjjjjjjjjjjjjjj",
"country": "Canada",
"currencyCode": "CAD",
"access_token": null,
"direct_buy": false,
"skip_system": false,
"skip_business": false,
"send_confirmation_notification": true,
"capacity": null,
"provisioner": "magnum",
"referring_url": null,
"landing_url": null,
"referralid": null,
"web_promo": null,
"visitor_id": null,
"optimizely_user_id": "oeu1556551964423r0.989078205100306",
"optimizely_buckets": null
}'
https://api.freshbooks.com/auth/api/v1/smux/registrations
Postman Collection Item JSON
{
"name": "Register as a new user",
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"api.freshbooks@gmail.com\",\n \"company_name\": null,\n \"email\": \"api.freshbooks@gmail.com\",\n \"password\": \"jjjjjjjjjjjjjjjjjjj\",\n \"country\": \"Canada\",\n \"currencyCode\": \"CAD\",\n \"access_token\": null,\n \"direct_buy\": false,\n \"skip_system\": false,\n \"skip_business\": false,\n \"send_confirmation_notification\": true,\n \"capacity\": null,\n \"provisioner\": \"magnum\",\n \"referring_url\": null,\n \"landing_url\": null,\n \"referralid\": null,\n \"web_promo\": null,\n \"visitor_id\": null,\n \"optimizely_user_id\": \"oeu1556551964423r0.989078205100306\",\n \"optimizely_buckets\": null\n}"
},
"url": {
"raw": "https://api.freshbooks.com/auth/api/v1/smux/registrations",
"protocol": "https",
"host": [
"api",
"freshbooks",
"com"
],
"path": [
"auth",
"api",
"v1",
"smux",
"registrations"
]
}
},
"response": [
]
}