List users, returning a maximum of 100 users per page.
curl https://subdomain.zendesk.com/api/v2/users.json \
-u zendesk_email/token:zendesk_api_token
Chilkat.Rest rest = new Chilkat.Rest();
bool success;
// URL: https://subdomain.zendesk.com/api/v2/users.json
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = await rest.ConnectAsync("subdomain.zendesk.com",port,bTls,bAutoReconnect);
if (success != true) {
Debug.WriteLine("ConnectFailReason: " + Convert.ToString(rest.ConnectFailReason));
Debug.WriteLine(rest.LastErrorText);
return;
}
rest.SetAuthBasic("zendesk_email/token","zendesk_api_token");
Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
success = await rest.FullRequestNoBodySbAsync("GET","/api/v2/users.json",sbResponseBody);
if (success != true) {
Debug.WriteLine(rest.LastErrorText);
return;
}
int respStatusCode = rest.ResponseStatusCode;
if (respStatusCode >= 400) {
Debug.WriteLine("Response Status Code = " + Convert.ToString(respStatusCode));
Debug.WriteLine("Response Header:");
Debug.WriteLine(rest.ResponseHeader);
Debug.WriteLine("Response Body:");
Debug.WriteLine(sbResponseBody.GetAsString());
return;
}
Chilkat.JsonObject jsonResponse = new Chilkat.JsonObject();
jsonResponse.LoadSb(sbResponseBody);
string next_page;
string previous_page;
int count;
int i;
int count_i;
int id;
string url;
string name;
string email;
string created_at;
string updated_at;
string time_zone;
string phone;
string shared_phone_number;
string photo;
int locale_id;
string locale;
int organization_id;
string role;
bool verified;
string external_id;
string alias;
bool active;
bool shared;
bool shared_agent;
string last_login_at;
string two_factor_auth_enabled;
string signature;
string details;
string notes;
string role_type;
string custom_role_id;
bool moderator;
string ticket_restriction;
bool only_private_comments;
bool restricted_agent;
bool suspended;
bool chat_only;
int default_group_id;
string photoUrl;
int photoId;
string photoFile_name;
string photoContent_url;
string photoMapped_content_url;
string photoContent_type;
int photoSize;
int photoWidth;
int photoHeight;
bool photoInline;
int j;
int count_j;
string strVal;
string file_name;
string content_url;
string mapped_content_url;
string content_type;
int size;
int width;
int height;
bool inline;
next_page = jsonResponse.StringOf("next_page");
previous_page = jsonResponse.StringOf("previous_page");
count = jsonResponse.IntOf("count");
i = 0;
count_i = jsonResponse.SizeOfArray("users");
while (i < count_i) {
jsonResponse.I = i;
id = jsonResponse.IntOf("users[i].id");
url = jsonResponse.StringOf("users[i].url");
name = jsonResponse.StringOf("users[i].name");
email = jsonResponse.StringOf("users[i].email");
created_at = jsonResponse.StringOf("users[i].created_at");
updated_at = jsonResponse.StringOf("users[i].updated_at");
time_zone = jsonResponse.StringOf("users[i].time_zone");
phone = jsonResponse.StringOf("users[i].phone");
shared_phone_number = jsonResponse.StringOf("users[i].shared_phone_number");
photo = jsonResponse.StringOf("users[i].photo");
locale_id = jsonResponse.IntOf("users[i].locale_id");
locale = jsonResponse.StringOf("users[i].locale");
organization_id = jsonResponse.IntOf("users[i].organization_id");
role = jsonResponse.StringOf("users[i].role");
verified = jsonResponse.BoolOf("users[i].verified");
external_id = jsonResponse.StringOf("users[i].external_id");
alias = jsonResponse.StringOf("users[i].alias");
active = jsonResponse.BoolOf("users[i].active");
shared = jsonResponse.BoolOf("users[i].shared");
shared_agent = jsonResponse.BoolOf("users[i].shared_agent");
last_login_at = jsonResponse.StringOf("users[i].last_login_at");
two_factor_auth_enabled = jsonResponse.StringOf("users[i].two_factor_auth_enabled");
signature = jsonResponse.StringOf("users[i].signature");
details = jsonResponse.StringOf("users[i].details");
notes = jsonResponse.StringOf("users[i].notes");
role_type = jsonResponse.StringOf("users[i].role_type");
custom_role_id = jsonResponse.StringOf("users[i].custom_role_id");
moderator = jsonResponse.BoolOf("users[i].moderator");
ticket_restriction = jsonResponse.StringOf("users[i].ticket_restriction");
only_private_comments = jsonResponse.BoolOf("users[i].only_private_comments");
restricted_agent = jsonResponse.BoolOf("users[i].restricted_agent");
suspended = jsonResponse.BoolOf("users[i].suspended");
chat_only = jsonResponse.BoolOf("users[i].chat_only");
default_group_id = jsonResponse.IntOf("users[i].default_group_id");
photoUrl = jsonResponse.StringOf("users[i].photo.url");
photoId = jsonResponse.IntOf("users[i].photo.id");
photoFile_name = jsonResponse.StringOf("users[i].photo.file_name");
photoContent_url = jsonResponse.StringOf("users[i].photo.content_url");
photoMapped_content_url = jsonResponse.StringOf("users[i].photo.mapped_content_url");
photoContent_type = jsonResponse.StringOf("users[i].photo.content_type");
photoSize = jsonResponse.IntOf("users[i].photo.size");
photoWidth = jsonResponse.IntOf("users[i].photo.width");
photoHeight = jsonResponse.IntOf("users[i].photo.height");
photoInline = jsonResponse.BoolOf("users[i].photo.inline");
j = 0;
count_j = jsonResponse.SizeOfArray("users[i].tags");
while (j < count_j) {
jsonResponse.J = j;
strVal = jsonResponse.StringOf("users[i].tags[j]");
j = j + 1;
}
j = 0;
count_j = jsonResponse.SizeOfArray("users[i].photo.thumbnails");
while (j < count_j) {
jsonResponse.J = j;
url = jsonResponse.StringOf("users[i].photo.thumbnails[j].url");
id = jsonResponse.IntOf("users[i].photo.thumbnails[j].id");
file_name = jsonResponse.StringOf("users[i].photo.thumbnails[j].file_name");
content_url = jsonResponse.StringOf("users[i].photo.thumbnails[j].content_url");
mapped_content_url = jsonResponse.StringOf("users[i].photo.thumbnails[j].mapped_content_url");
content_type = jsonResponse.StringOf("users[i].photo.thumbnails[j].content_type");
size = jsonResponse.IntOf("users[i].photo.thumbnails[j].size");
width = jsonResponse.IntOf("users[i].photo.thumbnails[j].width");
height = jsonResponse.IntOf("users[i].photo.thumbnails[j].height");
inline = jsonResponse.BoolOf("users[i].photo.thumbnails[j].inline");
j = j + 1;
}
i = i + 1;
}
{
"users": [
{
"id": 361801727573,
"url": "https://chilkat.zendesk.com/api/v2/users/361801727573.json",
"name": "Matt Fausey",
"email": "admin@chilkatsoft.com",
"created_at": "2018-04-14T19:01:56Z",
"updated_at": "2018-04-14T23:09:24Z",
"time_zone": "Bogota",
"phone": null,
"shared_phone_number": null,
"photo": null,
"locale_id": 1,
"locale": "en-US",
"organization_id": 360015071793,
"role": "admin",
"verified": true,
"external_id": null,
"tags": [
],
"alias": null,
"active": true,
"shared": false,
"shared_agent": false,
"last_login_at": "2018-04-14T23:09:24Z",
"two_factor_auth_enabled": null,
"signature": null,
"details": null,
"notes": null,
"role_type": null,
"custom_role_id": null,
"moderator": true,
"ticket_restriction": null,
"only_private_comments": false,
"restricted_agent": false,
"suspended": false,
"chat_only": false,
"default_group_id": 360000681553,
"user_fields": {}
},
{
"id": 361809055094,
"url": "https://chilkat.zendesk.com/api/v2/users/361809055094.json",
"name": "Sample customer",
"email": "customer@example.com",
"created_at": "2018-04-14T19:01:56Z",
"updated_at": "2018-04-14T19:01:57Z",
"time_zone": "Bogota",
"phone": null,
"shared_phone_number": null,
"photo": {
"url": "https://chilkat.zendesk.com/api/v2/attachments/360103279093.json",
"id": 360103279093,
"file_name": "profile_image_361809055094_2287229.jpg",
"content_url": "https://chilkat.zendesk.com/system/photos/3601/0327/9093/profile_image_361809055094_2287229.jpg",
"mapped_content_url": "https://chilkat.zendesk.com/system/photos/3601/0327/9093/profile_image_361809055094_2287229.jpg",
"content_type": "image/jpeg",
"size": 2587,
"width": 40,
"height": 40,
"inline": false,
"thumbnails": [
{
"url": "https://chilkat.zendesk.com/api/v2/attachments/360103279113.json",
"id": 360103279113,
"file_name": "profile_image_361809055094_2287229_thumb.jpg",
"content_url": "https://chilkat.zendesk.com/system/photos/3601/0327/9093/profile_image_361809055094_2287229_thumb.jpg",
"mapped_content_url": "https://chilkat.zendesk.com/system/photos/3601/0327/9093/profile_image_361809055094_2287229_thumb.jpg",
"content_type": "image/jpeg",
"size": 1980,
"width": 32,
"height": 32,
"inline": false
}
]
},
"locale_id": 1,
"locale": "en-US",
"organization_id": null,
"role": "end-user",
"verified": false,
"external_id": null,
"tags": [
],
"alias": null,
"active": true,
"shared": false,
"shared_agent": false,
"last_login_at": null,
"two_factor_auth_enabled": false,
"signature": null,
"details": null,
"notes": null,
"role_type": null,
"custom_role_id": null,
"moderator": false,
"ticket_restriction": "requested",
"only_private_comments": false,
"restricted_agent": true,
"suspended": false,
"chat_only": false,
"default_group_id": null,
"user_fields": {}
},
{
"id": 361810194934,
"url": "https://chilkat.zendesk.com/api/v2/users/361810194934.json",
"name": "matt",
"email": "matt@chilkat.io",
"created_at": "2018-04-14T20:58:33Z",
"updated_at": "2018-04-14T20:59:40Z",
"time_zone": "Central Time (US & Canada)",
"phone": null,
"shared_phone_number": null,
"photo": null,
"locale_id": 1,
"locale": "en-US",
"organization_id": 360015071793,
"role": "end-user",
"verified": false,
"external_id": null,
"tags": [
"lizard",
"gecko"
],
"alias": "",
"active": true,
"shared": false,
"shared_agent": false,
"last_login_at": null,
"two_factor_auth_enabled": false,
"signature": null,
"details": "",
"notes": "Likes coffee",
"role_type": null,
"custom_role_id": null,
"moderator": false,
"ticket_restriction": "requested",
"only_private_comments": false,
"restricted_agent": true,
"suspended": false,
"chat_only": false,
"default_group_id": null,
"user_fields": {}
},
{
"id": 361811376954,
"url": "https://chilkat.zendesk.com/api/v2/users/361811376954.json",
"name": "Roger Wilco",
"email": "roger@chilkat.io",
"created_at": "2018-04-14T23:09:24Z",
"updated_at": "2018-04-14T23:09:24Z",
"time_zone": "Bogota",
"phone": null,
"shared_phone_number": null,
"photo": null,
"locale_id": 1,
"locale": "en-US",
"organization_id": null,
"role": "end-user",
"verified": false,
"external_id": null,
"tags": [
],
"alias": null,
"active": true,
"shared": false,
"shared_agent": false,
"last_login_at": null,
"two_factor_auth_enabled": false,
"signature": null,
"details": null,
"notes": null,
"role_type": null,
"custom_role_id": null,
"moderator": false,
"ticket_restriction": "requested",
"only_private_comments": false,
"restricted_agent": true,
"suspended": false,
"chat_only": false,
"default_group_id": null,
"user_fields": {}
}
],
"next_page": null,
"previous_page": null,
"count": 4
}