Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "userdata": {
// "firstName": "userFirstName",
// "lastName": "userLastName",
// "email": "<email>",
// "username": "<username>"
// },
// "customdata": {
// "mobilePhone": "+12035408967",
// "streetAddress": "12 N Lands End Rd",
// "city": "Lantana",
// "state": "Florida",
// "zip": "20537",
// "privacyPolicy": true
// },
// "password": "Test123!",
// "recaptcha": "<recaptcha-token>",
// "verificationmethod": "email"
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("userdata.firstName","userFirstName")
loo_Json.UpdateString("userdata.lastName","userLastName")
loo_Json.UpdateString("userdata.email","<email>")
loo_Json.UpdateString("userdata.username","<username>")
loo_Json.UpdateString("customdata.mobilePhone","+12035408967")
loo_Json.UpdateString("customdata.streetAddress","12 N Lands End Rd")
loo_Json.UpdateString("customdata.city","Lantana")
loo_Json.UpdateString("customdata.state","Florida")
loo_Json.UpdateString("customdata.zip","20537")
loo_Json.UpdateBool("customdata.privacyPolicy",1)
loo_Json.UpdateString("password","Test123!")
loo_Json.UpdateString("recaptcha","<recaptcha-token>")
loo_Json.UpdateString("verificationmethod","email")
loo_Resp = loo_Http.PostJson3("https://login.salesforce.com{{site}}/services/auth/headless/init/registration","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Json
Curl Command
curl -X POST
-d '{
"userdata": {
"firstName": "userFirstName",
"lastName": "userLastName",
"email": "<email>",
"username": "<username>"
},
"customdata": {
"mobilePhone": "+12035408967",
"streetAddress": "12 N Lands End Rd",
"city": "Lantana",
"state": "Florida",
"zip": "20537",
"privacyPolicy": true
},
"password": "Test123!",
"recaptcha": "<recaptcha-token>",
"verificationmethod": "email"
}'
https://login.salesforce.com{{site}}/services/auth/headless/init/registration
Postman Collection Item JSON
{
"name": "Registration - Initialize",
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"content-type": true
}
},
"request": {
"auth": {
"type": "noauth"
},
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"userdata\": {\n \"firstName\": \"userFirstName\",\n \"lastName\": \"userLastName\",\n \"email\": \"<email>\",\n \"username\": \"<username>\"\n },\n \"customdata\": {\n \"mobilePhone\": \"+12035408967\",\n \"streetAddress\": \"12 N Lands End Rd\",\n \"city\": \"Lantana\",\n \"state\": \"Florida\",\n \"zip\": \"20537\",\n \"privacyPolicy\": true\n },\n \"password\": \"Test123!\",\n \"recaptcha\": \"<recaptcha-token>\",\n \"verificationmethod\": \"email\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{url}}{{site}}/services/auth/headless/init/registration",
"host": [
"{{url}}{{site}}"
],
"path": [
"services",
"auth",
"headless",
"init",
"registration"
]
},
"description": "Submits the registration data to the init/registration endpoint and returns a request identifier. At the same time, an OTP is sent out to the end users via email or sms. Registration data is passed in the request body, and is formatted with JSON, with 5 keys: `userdata`, `customdata`, `password`, `recaptcha`, and `verificationmethod`. The first two keys are JSON structures, and the last 3 keys are strings.\n\nThis request returns JSON, and includes an identifier (request identifier)."
},
"response": [
]
}