PowerBuilder / Support API / Show Self
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Name
string ls_Active
string ls_Alias
string ls_Chat_only
string ls_Created_at
string ls_Custom_role_id
string ls_Default_group_id
string ls_Details
string ls_V_Email
string ls_External_id
string ls_Iana_time_zone
string ls_Id
string ls_Last_login_at
string ls_Locale
string ls_Locale_id
string ls_Moderator
string ls_Notes
string ls_Only_private_comments
string ls_Organization_id
string ls_Phone
string ls_Dolore50
string ls_Remote_photo_url
string ls_Report_csv
string ls_Restricted_agent
string ls_Role
string ls_Role_type
string ls_V_Shared
string ls_Shared_agent
string ls_Shared_phone_number
string ls_Signature
string ls_Suspended
string ls_Tags
string ls_Ticket_restriction
string ls_Time_zone
string ls_Two_factor_auth_enabled
string ls_Updated_at
string ls_V_Url
integer li_Deserunt_c4
string ls_Verified
string ls_Authenticity_token
// 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
loo_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"
loo_Http.SetRequestHeader("Accept","application/json")
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://example.zendesk.com/api/v2/users/me",loo_SbResponseBody)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_SbResponseBody
return
end if
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Http.LastHeader
Write-Debug "Failed."
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "user": {
// "name": "<string>",
// "active": "<boolean>",
// "alias": "<string>",
// "chat_only": "<boolean>",
// "created_at": "<string>",
// "custom_role_id": "<integer>",
// "default_group_id": "<integer>",
// "details": "<string>",
// "email": "<string>",
// "external_id": "<string>",
// "iana_time_zone": "<string>",
// "id": "<integer>",
// "last_login_at": "<string>",
// "locale": "<string>",
// "locale_id": "<integer>",
// "moderator": "<boolean>",
// "notes": "<string>",
// "only_private_comments": "<boolean>",
// "organization_id": "<integer>",
// "phone": "<string>",
// "photo": {
// "dolore50": -51881550.25541992
// },
// "remote_photo_url": "<string>",
// "report_csv": "<boolean>",
// "restricted_agent": "<boolean>",
// "role": "<string>",
// "role_type": "<integer>",
// "shared": "<boolean>",
// "shared_agent": "<boolean>",
// "shared_phone_number": "<boolean>",
// "signature": "<string>",
// "suspended": "<boolean>",
// "tags": "<array>",
// "ticket_restriction": "<string>",
// "time_zone": "<string>",
// "two_factor_auth_enabled": "<boolean>",
// "updated_at": "<string>",
// "url": "<string>",
// "user_fields": {
// "deserunt_c4": -61141403
// },
// "verified": "<boolean>",
// "authenticity_token": "<string>"
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Name = loo_JResp.StringOf("user.name")
ls_Active = loo_JResp.StringOf("user.active")
ls_Alias = loo_JResp.StringOf("user.alias")
ls_Chat_only = loo_JResp.StringOf("user.chat_only")
ls_Created_at = loo_JResp.StringOf("user.created_at")
ls_Custom_role_id = loo_JResp.StringOf("user.custom_role_id")
ls_Default_group_id = loo_JResp.StringOf("user.default_group_id")
ls_Details = loo_JResp.StringOf("user.details")
ls_V_Email = loo_JResp.StringOf("user.email")
ls_External_id = loo_JResp.StringOf("user.external_id")
ls_Iana_time_zone = loo_JResp.StringOf("user.iana_time_zone")
ls_Id = loo_JResp.StringOf("user.id")
ls_Last_login_at = loo_JResp.StringOf("user.last_login_at")
ls_Locale = loo_JResp.StringOf("user.locale")
ls_Locale_id = loo_JResp.StringOf("user.locale_id")
ls_Moderator = loo_JResp.StringOf("user.moderator")
ls_Notes = loo_JResp.StringOf("user.notes")
ls_Only_private_comments = loo_JResp.StringOf("user.only_private_comments")
ls_Organization_id = loo_JResp.StringOf("user.organization_id")
ls_Phone = loo_JResp.StringOf("user.phone")
ls_Dolore50 = loo_JResp.StringOf("user.photo.dolore50")
ls_Remote_photo_url = loo_JResp.StringOf("user.remote_photo_url")
ls_Report_csv = loo_JResp.StringOf("user.report_csv")
ls_Restricted_agent = loo_JResp.StringOf("user.restricted_agent")
ls_Role = loo_JResp.StringOf("user.role")
ls_Role_type = loo_JResp.StringOf("user.role_type")
ls_V_Shared = loo_JResp.StringOf("user.shared")
ls_Shared_agent = loo_JResp.StringOf("user.shared_agent")
ls_Shared_phone_number = loo_JResp.StringOf("user.shared_phone_number")
ls_Signature = loo_JResp.StringOf("user.signature")
ls_Suspended = loo_JResp.StringOf("user.suspended")
ls_Tags = loo_JResp.StringOf("user.tags")
ls_Ticket_restriction = loo_JResp.StringOf("user.ticket_restriction")
ls_Time_zone = loo_JResp.StringOf("user.time_zone")
ls_Two_factor_auth_enabled = loo_JResp.StringOf("user.two_factor_auth_enabled")
ls_Updated_at = loo_JResp.StringOf("user.updated_at")
ls_V_Url = loo_JResp.StringOf("user.url")
li_Deserunt_c4 = loo_JResp.IntOf("user.user_fields.deserunt_c4")
ls_Verified = loo_JResp.StringOf("user.verified")
ls_Authenticity_token = loo_JResp.StringOf("user.authenticity_token")
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -u login:password -X GET
-H "Accept: application/json"
https://example.zendesk.com/api/v2/users/me
Postman Collection Item JSON
{
"name": "Show Self",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/users/me",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"users",
"me"
]
},
"description": "#### Allowed For\n\n* Anonymous users\n\n#### Authenticity Token\n\nThe endpoint returns an `authenticity_token`. Zendesk API calls made by end users from a Zendesk help center must include this token in the `X-CSRF-Token` HTTP header. This helps prevent [cross-site request forgery (CSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery) attacks.\n\nFor an example using an authenticity token, see the AJAX request in the [Upgrading from Templating API v1](https://developer.zendesk.com/documentation/help_center/help-center-templates/v1#jquery) documentation.\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/users/me",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"users",
"me"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"user\": {\n \"name\": \"<string>\",\n \"active\": \"<boolean>\",\n \"alias\": \"<string>\",\n \"chat_only\": \"<boolean>\",\n \"created_at\": \"<string>\",\n \"custom_role_id\": \"<integer>\",\n \"default_group_id\": \"<integer>\",\n \"details\": \"<string>\",\n \"email\": \"<string>\",\n \"external_id\": \"<string>\",\n \"iana_time_zone\": \"<string>\",\n \"id\": \"<integer>\",\n \"last_login_at\": \"<string>\",\n \"locale\": \"<string>\",\n \"locale_id\": \"<integer>\",\n \"moderator\": \"<boolean>\",\n \"notes\": \"<string>\",\n \"only_private_comments\": \"<boolean>\",\n \"organization_id\": \"<integer>\",\n \"phone\": \"<string>\",\n \"photo\": {\n \"dolore50\": -51881550.25541992\n },\n \"remote_photo_url\": \"<string>\",\n \"report_csv\": \"<boolean>\",\n \"restricted_agent\": \"<boolean>\",\n \"role\": \"<string>\",\n \"role_type\": \"<integer>\",\n \"shared\": \"<boolean>\",\n \"shared_agent\": \"<boolean>\",\n \"shared_phone_number\": \"<boolean>\",\n \"signature\": \"<string>\",\n \"suspended\": \"<boolean>\",\n \"tags\": \"<array>\",\n \"ticket_restriction\": \"<string>\",\n \"time_zone\": \"<string>\",\n \"two_factor_auth_enabled\": \"<boolean>\",\n \"updated_at\": \"<string>\",\n \"url\": \"<string>\",\n \"user_fields\": {\n \"deserunt_c4\": -61141403\n },\n \"verified\": \"<boolean>\",\n \"authenticity_token\": \"<string>\"\n }\n}"
}
]
}