Classic ASP / Egyptian eInvoicing SDK R1.5 / 5.1 Request Document Package as intermediary
Back to Collection Items
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' 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 = Server.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.
' {
' "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": ""
' }
' ]
' }
' }
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = Server.CreateObject("Chilkat.JsonObject")
success = json.UpdateString("type","Full")
success = json.UpdateString("format","XML")
success = json.UpdateString("queryParameters.dateFrom","2021-01-01T00:00:00.000Z")
success = json.UpdateString("queryParameters.dateTo","2021-01-31T00:00:00.000Z")
success = json.UpdateString("queryParameters.statuses[0]","Valid")
success = json.UpdateNewArray("queryParameters.productsInternalCodes")
success = json.UpdateString("queryParameters.receiverSenderType","0")
success = json.UpdateString("queryParameters.documentTypeNames[0]","C")
success = json.UpdateString("queryParameters.documentTypeNames[1]","D")
success = json.UpdateString("queryParameters.documentTypeNames[2]","I")
success = json.UpdateString("queryParameters.representedTaxpayerFilterType","1")
success = json.UpdateString("queryParameters.representeeRin","")
success = json.UpdateString("queryParameters.branchNumber","")
success = json.UpdateString("queryParameters.itemCodes[0].codeValue","")
success = json.UpdateString("queryParameters.itemCodes[0].codeType","")
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
' resp is a Chilkat.HttpResponse
Set resp = http.PostJson3("https://domain.com/api/v1/documentPackages/requests","application/json",json)
If (http.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( resp.StatusCode) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( resp.BodyStr) & "</pre>"
%>
</body>
</html>
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": [
]
}