Python / APPIA API / EDIT USER PROFILE
Back to Collection Items
import sys
import chilkat
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
http = chilkat.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.
# {
# "address": "ado ekiti",
# "dob": "23-5-2018",
# "nnok": "adeolu",
# "occupation": "engineer",
# "aonok": "balogun street",
# "ponok": 234,
# "rwnok": "son"
# }
json = chilkat.CkJsonObject()
json.UpdateString("address","ado ekiti")
json.UpdateString("dob","23-5-2018")
json.UpdateString("nnok","adeolu")
json.UpdateString("occupation","engineer")
json.UpdateString("aonok","balogun street")
json.UpdateInt("ponok",234)
json.UpdateString("rwnok","son")
http.SetRequestHeader("Content-Type","application/json")
# Adds the "Authorization: Bearer {{auth}}" header.
http.put_AuthToken("{{auth}}")
sbRequestBody = chilkat.CkStringBuilder()
json.EmitSb(sbRequestBody)
# resp is a CkHttpResponse
resp = http.PTextSb("PUT","https://domain.com/profile/",sbRequestBody,"utf-8","application/json",False,False)
if (http.get_LastMethodSuccess() == False):
print(http.lastErrorText())
sys.exit()
print(str(resp.get_StatusCode()))
print(resp.bodyStr())
Curl Command
curl -X PUT
-H "Content-Type: application/json"
-H "Authorization: Bearer {{auth}}"
-d '{
"address" : "ado ekiti",
"dob" : "23-5-2018",
"nnok" : "adeolu",
"occupation":"engineer",
"aonok" : "balogun street",
"ponok" : 234,
"rwnok" : "son"
}'
https://domain.com/profile/
Postman Collection Item JSON
{
"name": "EDIT USER PROFILE",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{auth}}"
}
],
"body": {
"mode": "raw",
"raw": " \t\t\t{\r\n \"address\" : \"ado ekiti\",\r\n \"dob\" : \"23-5-2018\",\r\n \"nnok\" : \"adeolu\",\r\n \"occupation\":\"engineer\",\r\n \"aonok\" : \"balogun street\",\r\n \"ponok\" : 234,\r\n \"rwnok\" : \"son\"\r\n \t\t\t}"
},
"url": {
"raw": "{{url}}/profile/",
"host": [
"{{url}}"
],
"path": [
"profile",
""
]
},
"description": "User profile update"
},
"response": [
]
}