Back to Collection Items
load ./chilkat.dll
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
set http [new_CkHttp]
# Use this online tool to generate code from sample JSON: Generate Code to Create JSON
# The following JSON is sent in the request body.
# {
# "type": "Full",
# "format": "XML",
# "queryParameters": {
# "dateFrom": "2021-01-01T00:00:00.000Z",
# "dateTo": "2021-01-31T00:00:00.000Z",
# "statuses": [
# "Valid"
# ],
# "productsInternalCodes": [
# ],
# "receiverSenderType": "0",
# "documentTypeNames": [
# "C",
# "D",
# "I"
# ],
# "representedTaxpayerFilterType": "1",
# "representeeRin": "",
# "branchNumber": "",
# "itemCodes": [
# {
# "codeValue": "",
# "codeType": ""
# }
# ]
# }
# }
set json [new_CkJsonObject]
CkJsonObject_UpdateString $json "type" "Full"
CkJsonObject_UpdateString $json "format" "XML"
CkJsonObject_UpdateString $json "queryParameters.dateFrom" "2021-01-01T00:00:00.000Z"
CkJsonObject_UpdateString $json "queryParameters.dateTo" "2021-01-31T00:00:00.000Z"
CkJsonObject_UpdateString $json "queryParameters.statuses[0]" "Valid"
CkJsonObject_UpdateNewArray $json "queryParameters.productsInternalCodes"
CkJsonObject_UpdateString $json "queryParameters.receiverSenderType" "0"
CkJsonObject_UpdateString $json "queryParameters.documentTypeNames[0]" "C"
CkJsonObject_UpdateString $json "queryParameters.documentTypeNames[1]" "D"
CkJsonObject_UpdateString $json "queryParameters.documentTypeNames[2]" "I"
CkJsonObject_UpdateString $json "queryParameters.representedTaxpayerFilterType" "1"
CkJsonObject_UpdateString $json "queryParameters.representeeRin" ""
CkJsonObject_UpdateString $json "queryParameters.branchNumber" ""
CkJsonObject_UpdateString $json "queryParameters.itemCodes[0].codeValue" ""
CkJsonObject_UpdateString $json "queryParameters.itemCodes[0].codeType" ""
# Adds the "Authorization: Bearer <access_token>" header.
CkHttp_put_AuthToken $http "<access_token>"
# resp is a CkHttpResponse
set resp [CkHttp_PostJson3 $http "https://domain.com/api/v1/documentPackages/requests" "application/json" $json]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkJsonObject $json
exit
}
puts [CkHttpResponse_get_StatusCode $resp]
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttpResponse $resp
delete_CkHttp $http
delete_CkJsonObject $json
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-d '{
"type": "Full",
"format": "XML",
"queryParameters": {
"dateFrom": "2021-01-01T00:00:00.000Z",
"dateTo": "2021-01-31T00:00:00.000Z",
"statuses": [
"Valid"
],
"productsInternalCodes": [],
"receiverSenderType": "0",
"documentTypeNames": [
"C",
"D",
"I"
],
"representedTaxpayerFilterType": "1",
"representeeRin": "",
"branchNumber": "",
"itemCodes": [
{
"codeValue": "",
"codeType": ""
}
]
}
}'
https://domain.com/api/v1/documentPackages/requests
Postman Collection Item JSON
{
"name": "5.1 Request Document Package as intermediary",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{generatedAccessToken}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\r\n \"type\": \"Full\",\r\n \"format\": \"XML\",\r\n \"queryParameters\": {\r\n \"dateFrom\": \"2021-01-01T00:00:00.000Z\",\r\n \"dateTo\": \"2021-01-31T00:00:00.000Z\",\r\n \"statuses\": [\r\n \"Valid\"\r\n ],\r\n \"productsInternalCodes\": [],\r\n \"receiverSenderType\": \"0\",\r\n \"documentTypeNames\": [\r\n \"C\",\r\n \"D\",\r\n \"I\"\r\n ],\r\n \"representedTaxpayerFilterType\": \"1\",\r\n \"representeeRin\": \"\",\r\n \"branchNumber\": \"\",\r\n \"itemCodes\": [\r\n {\r\n \"codeValue\": \"\",\r\n \"codeType\": \"\"\r\n }\r\n ]\r\n }\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{apiBaseUrl}}/api/v1/documentPackages/requests",
"host": [
"{{apiBaseUrl}}"
],
"path": [
"api",
"v1",
"documentPackages",
"requests"
]
}
},
"response": [
]
}