PowerBuilder / Egyptian eInvoicing SDK R1.5 / 5.1 Request Document Package as intermediary
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// 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": ""
// }
// ]
// }
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("type","Full")
loo_Json.UpdateString("format","XML")
loo_Json.UpdateString("queryParameters.dateFrom","2021-01-01T00:00:00.000Z")
loo_Json.UpdateString("queryParameters.dateTo","2021-01-31T00:00:00.000Z")
loo_Json.UpdateString("queryParameters.statuses[0]","Valid")
loo_Json.UpdateNewArray("queryParameters.productsInternalCodes")
loo_Json.UpdateString("queryParameters.receiverSenderType","0")
loo_Json.UpdateString("queryParameters.documentTypeNames[0]","C")
loo_Json.UpdateString("queryParameters.documentTypeNames[1]","D")
loo_Json.UpdateString("queryParameters.documentTypeNames[2]","I")
loo_Json.UpdateString("queryParameters.representedTaxpayerFilterType","1")
loo_Json.UpdateString("queryParameters.representeeRin","")
loo_Json.UpdateString("queryParameters.branchNumber","")
loo_Json.UpdateString("queryParameters.itemCodes[0].codeValue","")
loo_Json.UpdateString("queryParameters.itemCodes[0].codeType","")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Resp = loo_Http.PostJson3("https://domain.com/api/v1/documentPackages/requests","application/json",loo_Json)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_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": [
]
}