PureBasic / APPIA API / RESET PASSWORD
Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
; Use this online tool to generate code from sample JSON: Generate Code to Create JSON
; The following JSON is sent in the request body.
; {
; "email": "tosinolugbenga@gmail.com"
; }
json.i = CkJsonObject::ckCreate()
If json.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateString(json,"email","tosinolugbenga@gmail.com")
CkHttp::ckSetRequestHeader(http,"Content-Type","application/json")
resp.i = CkHttpResponse::ckCreate()
If resp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkHttp::ckHttpJson(http,"POST","https://domain.com/users/reset_password",json,"application/json",resp)
If success = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
CkHttpResponse::ckDispose(resp)
ProcedureReturn
EndIf
Debug Str(CkHttpResponse::ckStatusCode(resp))
Debug CkHttpResponse::ckBodyStr(resp)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
CkHttpResponse::ckDispose(resp)
ProcedureReturn
EndProcedure
Curl Command
curl -X POST
-H "Content-Type: application/json"
-d '{
"email":"tosinolugbenga@gmail.com"
}'
https://domain.com/users/reset_password
Postman Collection Item JSON
{
"name": "RESET PASSWORD",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n\"email\":\"tosinolugbenga@gmail.com\"\n}"
},
"url": {
"raw": "{{url}}/users/reset_password",
"host": [
"{{url}}"
],
"path": [
"users",
"reset_password"
]
}
},
"response": [
]
}