Foxpro / Support API / Update Identity
Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcUser_id
LOCAL lcV_Type
LOCAL lcValue
LOCAL lcCreated_at
LOCAL lcDeliverable_state
LOCAL lcId
LOCAL lcPrimary
LOCAL lcUndeliverable_count
LOCAL lcUpdated_at
LOCAL lcV_Url
LOCAL lcVerified
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
loHttp.BasicAuth = 1
loHttp.Login = "login"
loHttp.Password = "password"
loHttp.SetRequestHeader("Accept","application/json")
loResp = loHttp.QuickRequest("PUT","https://example.zendesk.com/api/v2/users/:user_id/identities/:user_identity_id")
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loResp.Header
? "Failed."
RELEASE loResp
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
RELEASE loResp
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "identity": {
* "user_id": "<integer>",
* "type": "google",
* "value": "<string>",
* "created_at": "<dateTime>",
* "deliverable_state": "<string>",
* "id": "<integer>",
* "primary": "<boolean>",
* "undeliverable_count": "<integer>",
* "updated_at": "<dateTime>",
* "url": "<string>",
* "verified": "<boolean>"
* }
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcUser_id = loJResp.StringOf("identity.user_id")
lcV_Type = loJResp.StringOf("identity.type")
lcValue = loJResp.StringOf("identity.value")
lcCreated_at = loJResp.StringOf("identity.created_at")
lcDeliverable_state = loJResp.StringOf("identity.deliverable_state")
lcId = loJResp.StringOf("identity.id")
lcPrimary = loJResp.StringOf("identity.primary")
lcUndeliverable_count = loJResp.StringOf("identity.undeliverable_count")
lcUpdated_at = loJResp.StringOf("identity.updated_at")
lcV_Url = loJResp.StringOf("identity.url")
lcVerified = loJResp.StringOf("identity.verified")
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -u login:password -X PUT
-H "Accept: application/json"
https://example.zendesk.com/api/v2/users/:user_id/identities/:user_identity_id
Postman Collection Item JSON
{
"name": "Update Identity",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/users/:user_id/identities/:user_identity_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"users",
":user_id",
"identities",
":user_identity_id"
],
"variable": [
{
"key": "user_id",
"value": "<integer>"
},
{
"key": "user_identity_id",
"value": "<integer>"
}
]
},
"description": "This endpoint allows you to:\n\n* Set the specified identity as verified (but you cannot unverify a verified identity)\n* Update the `value` property of the specified identity\n\nYou can't change an identity's `primary` attribute with this endpoint. You must use the [Make Identity Primary](#make-identity-primary) endpoint instead.\n\n#### Allowed For\n\n* Agents\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/users/:user_id/identities/:user_identity_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"users",
":user_id",
"identities",
":user_identity_id"
],
"variable": [
{
"key": "user_id"
},
{
"key": "user_identity_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"identity\": {\n \"user_id\": \"<integer>\",\n \"type\": \"google\",\n \"value\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"deliverable_state\": \"<string>\",\n \"id\": \"<integer>\",\n \"primary\": \"<boolean>\",\n \"undeliverable_count\": \"<integer>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\",\n \"verified\": \"<boolean>\"\n }\n}"
}
]
}