Back to Collection Items
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' 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")
set http = CreateObject("Chilkat.Http")
' Use this online tool to generate code from sample JSON: Generate Code to Create JSON
' The following JSON is sent in the request body.
' {
' "documentTypeCodeName": "creditupdated",
' "namePrimaryLang": "CreditEn",
' "nameSecondaryLang": "CreditAr",
' "descriptionPrimaryLang": "Des-creditEn",
' "descriptionSecondaryLang": "Des-creditAr",
' "activeFrom": "2020-06-09T07:38:54.836Z"
' }
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = CreateObject("Chilkat.JsonObject")
success = json.UpdateString("documentTypeCodeName","creditupdated")
success = json.UpdateString("namePrimaryLang","CreditEn")
success = json.UpdateString("nameSecondaryLang","CreditAr")
success = json.UpdateString("descriptionPrimaryLang","Des-creditEn")
success = json.UpdateString("descriptionSecondaryLang","Des-creditAr")
success = json.UpdateString("activeFrom","2020-06-09T07:38:54.836Z")
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
http.SetRequestHeader "Accept-Language","ar"
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbRequestBody = CreateObject("Chilkat.StringBuilder")
success = json.EmitSb(sbRequestBody)
' resp is a Chilkat.HttpResponse
Set resp = http.PTextSb("GET","https://domain.com/api/v1/documenttypes",sbRequestBody,"utf-8","application/json",0,0)
If (http.LastMethodSuccess = 0) Then
outFile.WriteLine(http.LastErrorText)
WScript.Quit
End If
outFile.WriteLine(resp.StatusCode)
outFile.WriteLine(resp.BodyStr)
outFile.Close
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
-H "Accept-Language: ar"
-d '{
"documentTypeCodeName": "creditupdated",
"namePrimaryLang": "CreditEn",
"nameSecondaryLang": "CreditAr",
"descriptionPrimaryLang": "Des-creditEn",
"descriptionSecondaryLang": "Des-creditAr",
"activeFrom": "2020-06-09T07:38:54.836Z"
}'
https://domain.com/api/v1/documenttypes
Postman Collection Item JSON
{
"name": "2. Get Document Types",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{generatedAccessToken}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Accept-Language",
"value": "ar",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"documentTypeCodeName\": \"creditupdated\",\r\n \"namePrimaryLang\": \"CreditEn\",\r\n \"nameSecondaryLang\": \"CreditAr\",\r\n \"descriptionPrimaryLang\": \"Des-creditEn\",\r\n \"descriptionSecondaryLang\": \"Des-creditAr\",\r\n \"activeFrom\": \"2020-06-09T07:38:54.836Z\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{apiBaseUrl}}/api/v1/documenttypes",
"host": [
"{{apiBaseUrl}}"
],
"path": [
"api",
"v1",
"documenttypes"
]
}
},
"response": [
]
}