Chilkat Online Tools

TCL / New FreshBooks / Register as a new user

Back to Collection Items

load ./chilkat.dll

# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set http [new_CkHttp]

# 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
# }

set json [new_CkJsonObject]

CkJsonObject_UpdateString $json "id" "api.freshbooks@gmail.com"
CkJsonObject_UpdateNull $json "company_name"
CkJsonObject_UpdateString $json "email" "api.freshbooks@gmail.com"
CkJsonObject_UpdateString $json "password" "jjjjjjjjjjjjjjjjjjj"
CkJsonObject_UpdateString $json "country" "Canada"
CkJsonObject_UpdateString $json "currencyCode" "CAD"
CkJsonObject_UpdateNull $json "access_token"
CkJsonObject_UpdateBool $json "direct_buy" 0
CkJsonObject_UpdateBool $json "skip_system" 0
CkJsonObject_UpdateBool $json "skip_business" 0
CkJsonObject_UpdateBool $json "send_confirmation_notification" 1
CkJsonObject_UpdateNull $json "capacity"
CkJsonObject_UpdateString $json "provisioner" "magnum"
CkJsonObject_UpdateNull $json "referring_url"
CkJsonObject_UpdateNull $json "landing_url"
CkJsonObject_UpdateNull $json "referralid"
CkJsonObject_UpdateNull $json "web_promo"
CkJsonObject_UpdateNull $json "visitor_id"
CkJsonObject_UpdateString $json "optimizely_user_id" "oeu1556551964423r0.989078205100306"
CkJsonObject_UpdateNull $json "optimizely_buckets"

CkHttp_SetRequestHeader $http "Content-Type" "application/json"

# resp is a CkHttpResponse
set resp [CkHttp_PostJson3 $http "https://api.freshbooks.com/auth/api/v1/smux/registrations" "application/json" $json]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $json
    exit
}

puts [CkHttpResponse_get_StatusCode $resp]
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkJsonObject $json

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": [
  ]
}