Foxpro / New FreshBooks / Register as a new user
Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loResp
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat_9_5_0.Http')
* 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
* }
loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateString("id","api.freshbooks@gmail.com")
loJson.UpdateNull("company_name")
loJson.UpdateString("email","api.freshbooks@gmail.com")
loJson.UpdateString("password","jjjjjjjjjjjjjjjjjjj")
loJson.UpdateString("country","Canada")
loJson.UpdateString("currencyCode","CAD")
loJson.UpdateNull("access_token")
loJson.UpdateBool("direct_buy",0)
loJson.UpdateBool("skip_system",0)
loJson.UpdateBool("skip_business",0)
loJson.UpdateBool("send_confirmation_notification",1)
loJson.UpdateNull("capacity")
loJson.UpdateString("provisioner","magnum")
loJson.UpdateNull("referring_url")
loJson.UpdateNull("landing_url")
loJson.UpdateNull("referralid")
loJson.UpdateNull("web_promo")
loJson.UpdateNull("visitor_id")
loJson.UpdateString("optimizely_user_id","oeu1556551964423r0.989078205100306")
loJson.UpdateNull("optimizely_buckets")
loHttp.SetRequestHeader("Content-Type","application/json")
loResp = loHttp.PostJson3("https://api.freshbooks.com/auth/api/v1/smux/registrations","application/json",loJson)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loJson
CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp
RELEASE loHttp
RELEASE loJson
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": [
]
}