Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcV_type
LOCAL lnTime
LOCAL lcId
LOCAL lcFirst_name
LOCAL lcLast_name
LOCAL lcV_Email
LOCAL lcDial_code
LOCAL lcPhone_number
LOCAL lnEmail_verified
LOCAL lcTime_zone
LOCAL lcTitle
LOCAL lcBio
LOCAL lnUser_image
LOCAL i
LOCAL lnCount_i
* 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.SetRequestHeader("Authorization","")
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://api.squadcast.com/v3users/:userID",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
* 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 = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "data": {
* "id": "5d81d9187000fb6b9def7e31",
* "first_name": "Manigandan",
* "last_name": "Dharmalingam",
* "email": "manigandan@squadcast.com",
* "contact": {
* "dial_code": "+91",
* "phone_number": "9578628779"
* },
* "secondary_emails": [
* ],
* "email_verified": true,
* "time_zone": "Asia/Calcutta",
* "title": "",
* "bio": "",
* "notification_rules": [
* {
* "type": "Email",
* "time": 0
* },
* {
* "type": "Push",
* "time": 0
* },
* {
* "type": "SMS",
* "time": 1
* },
* {
* "type": "Phone",
* "time": 2
* }
* ],
* "user_image": false
* }
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcId = loJResp.StringOf("data.id")
lcFirst_name = loJResp.StringOf("data.first_name")
lcLast_name = loJResp.StringOf("data.last_name")
lcV_Email = loJResp.StringOf("data.email")
lcDial_code = loJResp.StringOf("data.contact.dial_code")
lcPhone_number = loJResp.StringOf("data.contact.phone_number")
lnEmail_verified = loJResp.BoolOf("data.email_verified")
lcTime_zone = loJResp.StringOf("data.time_zone")
lcTitle = loJResp.StringOf("data.title")
lcBio = loJResp.StringOf("data.bio")
lnUser_image = loJResp.BoolOf("data.user_image")
i = 0
lnCount_i = loJResp.SizeOfArray("data.secondary_emails")
DO WHILE i < lnCount_i
loJResp.I = i
i = i + 1
ENDDO
i = 0
lnCount_i = loJResp.SizeOfArray("data.notification_rules")
DO WHILE i < lnCount_i
loJResp.I = i
lcV_type = loJResp.StringOf("data.notification_rules[i].type")
lnTime = loJResp.IntOf("data.notification_rules[i].time")
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -X GET
-H "Authorization: "
https://api.squadcast.com/v3users/:userID
Postman Collection Item JSON
{
"name": "Get User By ID",
"request": {
"auth": {
"type": "noauth"
},
"method": "GET",
"header": [
{
"key": "Authorization",
"value": ""
}
],
"url": {
"raw": "{{baseUrl}}users/:userID",
"host": [
"{{baseUrl}}users"
],
"path": [
":userID"
],
"variable": [
{
"key": "userID",
"value": "<string>",
"type": "string",
"description": "(Required) user id"
}
]
},
"description": "Returns a users details of the given `userID` in the request param.\nRequires `access_token` as a `Bearer {{token}}` in the `Authorization` header with `read` scope."
},
"response": [
{
"name": "Unauthorized",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/users/:userID",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userID"
],
"variable": [
{
"key": "userID"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"meta\": {\n \"status\": \"<integer>\",\n \"error_message\": \"<string>\"\n }\n}"
},
{
"name": "OK",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/users/:userID",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userID"
],
"variable": [
{
"key": "userID"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"data\": {\n \"id\": \"5d81d9187000fb6b9def7e31\",\n \"first_name\": \"Manigandan\",\n \"last_name\": \"Dharmalingam\",\n \"email\": \"manigandan@squadcast.com\",\n \"contact\": {\n \"dial_code\": \"+91\",\n \"phone_number\": \"9578628779\"\n },\n \"secondary_emails\": [],\n \"email_verified\": true,\n \"time_zone\": \"Asia/Calcutta\",\n \"title\": \"\",\n \"bio\": \"\",\n \"notification_rules\": [\n {\n \"type\": \"Email\",\n \"time\": 0\n },\n {\n \"type\": \"Push\",\n \"time\": 0\n },\n {\n \"type\": \"SMS\",\n \"time\": 1\n },\n {\n \"type\": \"Phone\",\n \"time\": 2\n }\n ],\n \"user_image\": false\n }\n}"
},
{
"name": "Not Found",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/users/:userID",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userID"
],
"variable": [
{
"key": "userID"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"meta\": {\n \"status\": \"<integer>\",\n \"error_message\": \"<string>\"\n }\n}"
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/users/:userID",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userID"
],
"variable": [
{
"key": "userID"
}
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"meta\": {\n \"status\": \"<integer>\",\n \"error_message\": \"<string>\"\n }\n}"
},
{
"name": "Forbidden",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/users/:userID",
"host": [
"{{baseUrl}}"
],
"path": [
"users",
":userID"
],
"variable": [
{
"key": "userID"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"meta\": {\n \"status\": \"<integer>\",\n \"error_message\": \"<string>\"\n }\n}"
}
]
}