Back to Collection Items
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoHttp
Boolean iSuccess
Variant vJson
Handle hoJson
Variant vResp
Handle hoResp
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJResp
Integer iRespStatusCode
String sV_number
String sDescription
String sSale_price
String sId
String sV_type
String sDocument_note
String sNote
String sUnit
String sExport_identifier
String sV_NULL
String sNStb
String sNStbUstID
String sNStbNoneUstID
String sNStbIm
String sRevc
String sIG
String sAL
String sSStfr
String sSmallBusiness
String sLogin_id
String sPrice_type
Integer iVat_percent
String sSale_price2
String sSale_price3
String sSale_price4
String sSale_price5
String sSale_price6
String sSale_price7
String sSale_price8
String sSale_price9
String sSale_price10
String sCost_price
String sExport_cost1
String sExport_cost2
String sGroup_id
String sStock
Integer iStock_count
Boolean iStock_limit_notify
String sStock_limit_notify_frequency
Integer iStock_limit
String sQuantity
Boolean iArchived
String sTemp1
Boolean bTemp1
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "number": "<string>",
// "description": "<string>",
// "sale_price": "<float>",
// "id": "<long>",
// "type": "PRODUCT",
// "document_note": "<string>",
// "note": null,
// "unit": null,
// "export_identifier": null,
// "export_identifier_extended": {
// "NULL": null,
// "nStb": null,
// "nStbUstID": null,
// "nStbNoneUstID": null,
// "nStbIm": null,
// "revc": null,
// "IG": null,
// "AL": null,
// "sStfr": null,
// "smallBusiness": null
// },
// "login_id": "<long>",
// "price_type": "NETTO",
// "vat_percent": 19,
// "sale_price2": null,
// "sale_price3": null,
// "sale_price4": null,
// "sale_price5": null,
// "sale_price6": null,
// "sale_price7": null,
// "sale_price8": null,
// "sale_price9": null,
// "sale_price10": null,
// "cost_price": "<float>",
// "export_cost1": null,
// "export_cost2": null,
// "group_id": "<long>",
// "stock": "NO",
// "stock_count": 0,
// "stock_limit_notify": false,
// "stock_limit_notify_frequency": "ALWAYS",
// "stock_limit": 0,
// "quantity": null,
// "archived": false
// }
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get ComUpdateString Of hoJson "number" "<string>" To iSuccess
Get ComUpdateString Of hoJson "description" "<string>" To iSuccess
Get ComUpdateString Of hoJson "sale_price" "<float>" To iSuccess
Get ComUpdateString Of hoJson "id" "<long>" To iSuccess
Get ComUpdateString Of hoJson "type" "PRODUCT" To iSuccess
Get ComUpdateString Of hoJson "document_note" "<string>" To iSuccess
Get ComUpdateNull Of hoJson "note" To iSuccess
Get ComUpdateNull Of hoJson "unit" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.NULL" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.nStb" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.nStbUstID" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.nStbNoneUstID" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.nStbIm" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.revc" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.IG" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.AL" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.sStfr" To iSuccess
Get ComUpdateNull Of hoJson "export_identifier_extended.smallBusiness" To iSuccess
Get ComUpdateString Of hoJson "login_id" "<long>" To iSuccess
Get ComUpdateString Of hoJson "price_type" "NETTO" To iSuccess
Get ComUpdateInt Of hoJson "vat_percent" 19 To iSuccess
Get ComUpdateNull Of hoJson "sale_price2" To iSuccess
Get ComUpdateNull Of hoJson "sale_price3" To iSuccess
Get ComUpdateNull Of hoJson "sale_price4" To iSuccess
Get ComUpdateNull Of hoJson "sale_price5" To iSuccess
Get ComUpdateNull Of hoJson "sale_price6" To iSuccess
Get ComUpdateNull Of hoJson "sale_price7" To iSuccess
Get ComUpdateNull Of hoJson "sale_price8" To iSuccess
Get ComUpdateNull Of hoJson "sale_price9" To iSuccess
Get ComUpdateNull Of hoJson "sale_price10" To iSuccess
Get ComUpdateString Of hoJson "cost_price" "<float>" To iSuccess
Get ComUpdateNull Of hoJson "export_cost1" To iSuccess
Get ComUpdateNull Of hoJson "export_cost2" To iSuccess
Get ComUpdateString Of hoJson "group_id" "<long>" To iSuccess
Get ComUpdateString Of hoJson "stock" "NO" To iSuccess
Get ComUpdateInt Of hoJson "stock_count" 0 To iSuccess
Get ComUpdateBool Of hoJson "stock_limit_notify" False To iSuccess
Get ComUpdateString Of hoJson "stock_limit_notify_frequency" "ALWAYS" To iSuccess
Get ComUpdateInt Of hoJson "stock_limit" 0 To iSuccess
Get ComUpdateNull Of hoJson "quantity" To iSuccess
Get ComUpdateBool Of hoJson "archived" False To iSuccess
Send ComSetRequestHeader To hoHttp "Content-Type" "application/json"
Send ComSetRequestHeader To hoHttp "Authorization" "{{apiKey}}"
Send ComSetRequestHeader To hoHttp "Accept" "application/json"
Get pvComObject of hoJson to vJson
Get ComPostJson3 Of hoHttp "https://api.easybill.de/rest/v1/positions" "application/json" vJson To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess
Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
If (Not(IsComObjectCreated(hoJResp))) Begin
Send CreateComObject of hoJResp
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
Set ComEmitCompact Of hoJResp To False
Showln "Response Body:"
Get ComEmit Of hoJResp To sTemp1
Showln sTemp1
Get ComStatusCode Of hoResp To iRespStatusCode
Showln "Response Status Code = " iRespStatusCode
If (iRespStatusCode >= 400) Begin
Showln "Response Header:"
Get ComHeader Of hoResp To sTemp1
Showln sTemp1
Showln "Failed."
Send Destroy of hoResp
Procedure_Return
End
Send Destroy of hoResp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "number": "<string>",
// "description": "<string>",
// "sale_price": "<float>",
// "id": "<long>",
// "type": "PRODUCT",
// "document_note": "<string>",
// "note": null,
// "unit": null,
// "export_identifier": null,
// "export_identifier_extended": {
// "NULL": null,
// "nStb": null,
// "nStbUstID": null,
// "nStbNoneUstID": null,
// "nStbIm": null,
// "revc": null,
// "IG": null,
// "AL": null,
// "sStfr": null,
// "smallBusiness": null
// },
// "login_id": "<long>",
// "price_type": "NETTO",
// "vat_percent": 19,
// "sale_price2": null,
// "sale_price3": null,
// "sale_price4": null,
// "sale_price5": null,
// "sale_price6": null,
// "sale_price7": null,
// "sale_price8": null,
// "sale_price9": null,
// "sale_price10": null,
// "cost_price": "<float>",
// "export_cost1": null,
// "export_cost2": null,
// "group_id": "<long>",
// "stock": "NO",
// "stock_count": 0,
// "stock_limit_notify": false,
// "stock_limit_notify_frequency": "ALWAYS",
// "stock_limit": 0,
// "quantity": null,
// "archived": false
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Get ComStringOf Of hoJResp "number" To sV_number
Get ComStringOf Of hoJResp "description" To sDescription
Get ComStringOf Of hoJResp "sale_price" To sSale_price
Get ComStringOf Of hoJResp "id" To sId
Get ComStringOf Of hoJResp "type" To sV_type
Get ComStringOf Of hoJResp "document_note" To sDocument_note
Get ComStringOf Of hoJResp "note" To sNote
Get ComStringOf Of hoJResp "unit" To sUnit
Get ComStringOf Of hoJResp "export_identifier" To sExport_identifier
Get ComStringOf Of hoJResp "export_identifier_extended.NULL" To sV_NULL
Get ComStringOf Of hoJResp "export_identifier_extended.nStb" To sNStb
Get ComStringOf Of hoJResp "export_identifier_extended.nStbUstID" To sNStbUstID
Get ComStringOf Of hoJResp "export_identifier_extended.nStbNoneUstID" To sNStbNoneUstID
Get ComStringOf Of hoJResp "export_identifier_extended.nStbIm" To sNStbIm
Get ComStringOf Of hoJResp "export_identifier_extended.revc" To sRevc
Get ComStringOf Of hoJResp "export_identifier_extended.IG" To sIG
Get ComStringOf Of hoJResp "export_identifier_extended.AL" To sAL
Get ComStringOf Of hoJResp "export_identifier_extended.sStfr" To sSStfr
Get ComStringOf Of hoJResp "export_identifier_extended.smallBusiness" To sSmallBusiness
Get ComStringOf Of hoJResp "login_id" To sLogin_id
Get ComStringOf Of hoJResp "price_type" To sPrice_type
Get ComIntOf Of hoJResp "vat_percent" To iVat_percent
Get ComStringOf Of hoJResp "sale_price2" To sSale_price2
Get ComStringOf Of hoJResp "sale_price3" To sSale_price3
Get ComStringOf Of hoJResp "sale_price4" To sSale_price4
Get ComStringOf Of hoJResp "sale_price5" To sSale_price5
Get ComStringOf Of hoJResp "sale_price6" To sSale_price6
Get ComStringOf Of hoJResp "sale_price7" To sSale_price7
Get ComStringOf Of hoJResp "sale_price8" To sSale_price8
Get ComStringOf Of hoJResp "sale_price9" To sSale_price9
Get ComStringOf Of hoJResp "sale_price10" To sSale_price10
Get ComStringOf Of hoJResp "cost_price" To sCost_price
Get ComStringOf Of hoJResp "export_cost1" To sExport_cost1
Get ComStringOf Of hoJResp "export_cost2" To sExport_cost2
Get ComStringOf Of hoJResp "group_id" To sGroup_id
Get ComStringOf Of hoJResp "stock" To sStock
Get ComIntOf Of hoJResp "stock_count" To iStock_count
Get ComBoolOf Of hoJResp "stock_limit_notify" To iStock_limit_notify
Get ComStringOf Of hoJResp "stock_limit_notify_frequency" To sStock_limit_notify_frequency
Get ComIntOf Of hoJResp "stock_limit" To iStock_limit
Get ComStringOf Of hoJResp "quantity" To sQuantity
Get ComBoolOf Of hoJResp "archived" To iArchived
End_Procedure
Curl Command
curl -X POST
-H "Authorization: {{apiKey}}"
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"number": "<string>",
"description": "<string>",
"sale_price": "<float>",
"id": "<long>",
"type": "PRODUCT",
"document_note": "<string>",
"note": null,
"unit": null,
"export_identifier": null,
"export_identifier_extended": {
"NULL": null,
"nStb": null,
"nStbUstID": null,
"nStbNoneUstID": null,
"nStbIm": null,
"revc": null,
"IG": null,
"AL": null,
"sStfr": null,
"smallBusiness": null
},
"login_id": "<long>",
"price_type": "NETTO",
"vat_percent": 19,
"sale_price2": null,
"sale_price3": null,
"sale_price4": null,
"sale_price5": null,
"sale_price6": null,
"sale_price7": null,
"sale_price8": null,
"sale_price9": null,
"sale_price10": null,
"cost_price": "<float>",
"export_cost1": null,
"export_cost2": null,
"group_id": "<long>",
"stock": "NO",
"stock_count": 0,
"stock_limit_notify": false,
"stock_limit_notify_frequency": "ALWAYS",
"stock_limit": 0,
"quantity": null,
"archived": false
}'
https://api.easybill.de/rest/v1/positions
Postman Collection Item JSON
{
"name": "Create position",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"number\": \"<string>\",\n \"description\": \"<string>\",\n \"sale_price\": \"<float>\",\n \"id\": \"<long>\",\n \"type\": \"PRODUCT\",\n \"document_note\": \"<string>\",\n \"note\": null,\n \"unit\": null,\n \"export_identifier\": null,\n \"export_identifier_extended\": {\n \"NULL\": null,\n \"nStb\": null,\n \"nStbUstID\": null,\n \"nStbNoneUstID\": null,\n \"nStbIm\": null,\n \"revc\": null,\n \"IG\": null,\n \"AL\": null,\n \"sStfr\": null,\n \"smallBusiness\": null\n },\n \"login_id\": \"<long>\",\n \"price_type\": \"NETTO\",\n \"vat_percent\": 19,\n \"sale_price2\": null,\n \"sale_price3\": null,\n \"sale_price4\": null,\n \"sale_price5\": null,\n \"sale_price6\": null,\n \"sale_price7\": null,\n \"sale_price8\": null,\n \"sale_price9\": null,\n \"sale_price10\": null,\n \"cost_price\": \"<float>\",\n \"export_cost1\": null,\n \"export_cost2\": null,\n \"group_id\": \"<long>\",\n \"stock\": \"NO\",\n \"stock_count\": 0,\n \"stock_limit_notify\": false,\n \"stock_limit_notify_frequency\": \"ALWAYS\",\n \"stock_limit\": 0,\n \"quantity\": null,\n \"archived\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/positions",
"host": [
"{{baseUrl}}"
],
"path": [
"positions"
]
}
},
"response": [
{
"name": "Successful operation",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"number\": \"<string>\",\n \"description\": \"<string>\",\n \"sale_price\": \"<float>\",\n \"id\": \"<long>\",\n \"type\": \"PRODUCT\",\n \"document_note\": \"<string>\",\n \"note\": null,\n \"unit\": null,\n \"export_identifier\": null,\n \"export_identifier_extended\": {\n \"NULL\": null,\n \"nStb\": null,\n \"nStbUstID\": null,\n \"nStbNoneUstID\": null,\n \"nStbIm\": null,\n \"revc\": null,\n \"IG\": null,\n \"AL\": null,\n \"sStfr\": null,\n \"smallBusiness\": null\n },\n \"login_id\": \"<long>\",\n \"price_type\": \"NETTO\",\n \"vat_percent\": 19,\n \"sale_price2\": null,\n \"sale_price3\": null,\n \"sale_price4\": null,\n \"sale_price5\": null,\n \"sale_price6\": null,\n \"sale_price7\": null,\n \"sale_price8\": null,\n \"sale_price9\": null,\n \"sale_price10\": null,\n \"cost_price\": \"<float>\",\n \"export_cost1\": null,\n \"export_cost2\": null,\n \"group_id\": \"<long>\",\n \"stock\": \"NO\",\n \"stock_count\": 0,\n \"stock_limit_notify\": false,\n \"stock_limit_notify_frequency\": \"ALWAYS\",\n \"stock_limit\": 0,\n \"quantity\": null,\n \"archived\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/positions",
"host": [
"{{baseUrl}}"
],
"path": [
"positions"
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"number\": \"<string>\",\n \"description\": \"<string>\",\n \"sale_price\": \"<float>\",\n \"id\": \"<long>\",\n \"type\": \"PRODUCT\",\n \"document_note\": \"<string>\",\n \"note\": null,\n \"unit\": null,\n \"export_identifier\": null,\n \"export_identifier_extended\": {\n \"NULL\": null,\n \"nStb\": null,\n \"nStbUstID\": null,\n \"nStbNoneUstID\": null,\n \"nStbIm\": null,\n \"revc\": null,\n \"IG\": null,\n \"AL\": null,\n \"sStfr\": null,\n \"smallBusiness\": null\n },\n \"login_id\": \"<long>\",\n \"price_type\": \"NETTO\",\n \"vat_percent\": 19,\n \"sale_price2\": null,\n \"sale_price3\": null,\n \"sale_price4\": null,\n \"sale_price5\": null,\n \"sale_price6\": null,\n \"sale_price7\": null,\n \"sale_price8\": null,\n \"sale_price9\": null,\n \"sale_price10\": null,\n \"cost_price\": \"<float>\",\n \"export_cost1\": null,\n \"export_cost2\": null,\n \"group_id\": \"<long>\",\n \"stock\": \"NO\",\n \"stock_count\": 0,\n \"stock_limit_notify\": false,\n \"stock_limit_notify_frequency\": \"ALWAYS\",\n \"stock_limit\": 0,\n \"quantity\": null,\n \"archived\": false\n}"
},
{
"name": "Too Many Requests",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "Authorization",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"number\": \"<string>\",\n \"description\": \"<string>\",\n \"sale_price\": \"<float>\",\n \"id\": \"<long>\",\n \"type\": \"PRODUCT\",\n \"document_note\": \"<string>\",\n \"note\": null,\n \"unit\": null,\n \"export_identifier\": null,\n \"export_identifier_extended\": {\n \"NULL\": null,\n \"nStb\": null,\n \"nStbUstID\": null,\n \"nStbNoneUstID\": null,\n \"nStbIm\": null,\n \"revc\": null,\n \"IG\": null,\n \"AL\": null,\n \"sStfr\": null,\n \"smallBusiness\": null\n },\n \"login_id\": \"<long>\",\n \"price_type\": \"NETTO\",\n \"vat_percent\": 19,\n \"sale_price2\": null,\n \"sale_price3\": null,\n \"sale_price4\": null,\n \"sale_price5\": null,\n \"sale_price6\": null,\n \"sale_price7\": null,\n \"sale_price8\": null,\n \"sale_price9\": null,\n \"sale_price10\": null,\n \"cost_price\": \"<float>\",\n \"export_cost1\": null,\n \"export_cost2\": null,\n \"group_id\": \"<long>\",\n \"stock\": \"NO\",\n \"stock_count\": 0,\n \"stock_limit_notify\": false,\n \"stock_limit_notify_frequency\": \"ALWAYS\",\n \"stock_limit\": 0,\n \"quantity\": null,\n \"archived\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/positions",
"host": [
"{{baseUrl}}"
],
"path": [
"positions"
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
}
]
}