Chilkat Online Tools

Xojo / New FreshBooks / Register as a new user

Back to Collection Items

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

Dim http As New Chilkat.Http
Dim success As Boolean

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

Dim json As New Chilkat.JsonObject
success = json.UpdateString("id","api.freshbooks@gmail.com")
success = json.UpdateNull("company_name")
success = json.UpdateString("email","api.freshbooks@gmail.com")
success = json.UpdateString("password","jjjjjjjjjjjjjjjjjjj")
success = json.UpdateString("country","Canada")
success = json.UpdateString("currencyCode","CAD")
success = json.UpdateNull("access_token")
success = json.UpdateBool("direct_buy",False)
success = json.UpdateBool("skip_system",False)
success = json.UpdateBool("skip_business",False)
success = json.UpdateBool("send_confirmation_notification",True)
success = json.UpdateNull("capacity")
success = json.UpdateString("provisioner","magnum")
success = json.UpdateNull("referring_url")
success = json.UpdateNull("landing_url")
success = json.UpdateNull("referralid")
success = json.UpdateNull("web_promo")
success = json.UpdateNull("visitor_id")
success = json.UpdateString("optimizely_user_id","oeu1556551964423r0.989078205100306")
success = json.UpdateNull("optimizely_buckets")

http.SetRequestHeader "Content-Type","application/json"

Dim resp As Chilkat.HttpResponse
resp = http.PostJson3("https://api.freshbooks.com/auth/api/v1/smux/registrations","application/json",json)
If (http.LastMethodSuccess = False) Then
    System.DebugLog(http.LastErrorText)
    Return
End If

System.DebugLog(Str(resp.StatusCode))
System.DebugLog(resp.BodyStr)

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