Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcValue
LOCAL lcId
LOCAL lcLink
LOCAL lcCollected_at
LOCAL lcDisplay_name
LOCAL lcFirst_name
LOCAL lcLast_name
LOCAL lcSecond_last_name
LOCAL lcAddress
LOCAL lcEmail
LOCAL lcPhone_number
LOCAL lcCollected_at
LOCAL lcStatus
LOCAL lcAcceptance_rate
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.BasicAuth = 1
loHttp.Login = "{{secretId}}"
loHttp.Password = "{{secretPassword}}"
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://domain.com/api/owners/:id/",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)
* {
* "id": "<uuid>",
* "link": "<uuid>",
* "collected_at": "<dateTime>",
* "display_name": "<string>",
* "first_name": "<string>",
* "last_name": "<string>",
* "second_last_name": "<string>",
* "address": "<string>",
* "email": "<email>",
* "phone_number": "<string>",
* "accounts": [
* {
* "value": "<Error: Too many levels of nesting to fake this schema>"
* },
* {
* "value": "<Error: Too many levels of nesting to fake this schema>"
* }
* ],
* "gig_data": {
* "collected_at": "<dateTime>",
* "status": "<string>",
* "acceptance_rate": "<number>"
* }
* }
* 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("id")
lcLink = loJResp.StringOf("link")
lcCollected_at = loJResp.StringOf("collected_at")
lcDisplay_name = loJResp.StringOf("display_name")
lcFirst_name = loJResp.StringOf("first_name")
lcLast_name = loJResp.StringOf("last_name")
lcSecond_last_name = loJResp.StringOf("second_last_name")
lcAddress = loJResp.StringOf("address")
lcEmail = loJResp.StringOf("email")
lcPhone_number = loJResp.StringOf("phone_number")
lcCollected_at = loJResp.StringOf("gig_data.collected_at")
lcStatus = loJResp.StringOf("gig_data.status")
lcAcceptance_rate = loJResp.StringOf("gig_data.acceptance_rate")
i = 0
lnCount_i = loJResp.SizeOfArray("accounts")
DO WHILE i < lnCount_i
loJResp.I = i
lcValue = loJResp.StringOf("accounts[i].value")
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -X GET
-u '{{secretId}}:{{secretPassword}}'
https://domain.com/api/owners/:id/
Postman Collection Item JSON
{
"name": "Detail",
"request": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/owners/:id/",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"owners",
":id",
""
],
"variable": [
{
"key": "id",
"value": "consequa",
"description": "(Required) The `owner.id` you want to get detailed information about."
}
]
},
"description": "Get the details of a specific owner."
},
"response": [
{
"name": "Ok",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/owners/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"owners",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n\t\"id\": \"<uuid>\",\n\t\"link\": \"<uuid>\",\n\t\"collected_at\": \"<dateTime>\",\n\t\"display_name\": \"<string>\",\n\t\"first_name\": \"<string>\",\n\t\"last_name\": \"<string>\",\n\t\"second_last_name\": \"<string>\",\n\t\"address\": \"<string>\",\n\t\"email\": \"<email>\",\n\t\"phone_number\": \"<string>\",\n\t\"accounts\": [\n\t\t{\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t},\n\t\t{\n\t\t\t\"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n\t\t}\n\t],\n\t\"gig_data\": {\n\t\t\"collected_at\": \"<dateTime>\",\n\t\t\"status\": \"<string>\",\n\t\t\"acceptance_rate\": \"<number>\"\n\t}\n}"
},
{
"name": "Unauthorized",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/owners/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"owners",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "[\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t},\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t}\n]"
},
{
"name": "Too Many Sessions",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/owners/:id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"owners",
":id"
],
"variable": [
{
"key": "id"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "[\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t},\n\t{\n\t\t\"code\": \"<string>\",\n\t\t\"message\": \"<string>\",\n\t\t\"request_id\": \"<string>\"\n\t}\n]"
}
]
}