forum

Debat om e-conomic regnskabsprogram

Problem with REST api, formatting JSON-entries

0

I  can create a draft invoice by doing this (i.e. by using the JSON I get from a GETting an existing draft invoice I created manually i the GUI) so it works but i dont know why.

 

curl -ki -H"appId: SECRET" -H"accessId: SECRET" -H"Content-Type: application/json" https://restapi.e-conomic.com/invoices/drafts -X  POST -d'{"lines":[{"unitId":2,"lineNumber":1,"quantity":63.00,"unitPrice":63.00,"unitNetPrice":63.00,"unitCostPrice":300.00,"discountPercentage":0.00,"totalNetAmount":529.00,"product":{"id":"9988","name":"API test","priceCost":0.00,"priceRecommended":0.00,"priceSales":0.00,"isAccessible":true,"packageVolume":0.00,"productGroupId":1,"amountAvailable":0.0,"amountInStock":0.0,"amountOrderedFromSuppliers":0.0,"amountOrderedByCustomers":0.0,"self":"https://restapi.e-conomic.com/products/9988"},"salesDocumentLineType":"draftInvoiceLine","self":"https://restapi.e-conomic.com/invoices/drafts/2/lines/1"}],"currencyExchangeRate":100.000000,"margin":-6371.00,"marginPercentage":-1204.35,"id":2,"customer":{"customerNumber":665544,"currency":"DKK","paymentTerms":{"paymentTermsNumber":2,"self":"https://restapi.e-conomic.com/payment-terms/2"},"customerGroup":{"customerGroupNumber":0,"self":"https://restapi.e-conomic.com/customer-groups/1"},"vatZone":"HomeCountry","address":"API LOL LOL LOL","balance":0.00,"city":"Kolding","country":"Danmark","barred":false,"name":"Hest","zip":"6000","self":"https://restapi.e-conomic.com/customers/665544"},"customerName":"Hest","customerAddress":"API LOL LOL LOL","customerPostalCode":"6000","customerCity":"Kolding","customerCountry":"Danmark","date":"2014-08-13","dueDate":"2014-09-30","paymentTerms":{"paymentTermsNumber":2,"self":"https://restapi.e-conomic.com/payment-terms/2"},"currency":"DKK","vatIncluded":true,"layout":{"layoutNumber":19,"name":"DK. std. m. bankoplys. 1.5","self":"https://restapi.e-conomic.com/layouts/19"},"netAmount":529.00,"grossAmount":661.25,"vatAmount":132.25,"roundingAmount":0.00,"deductionAmount":0.00,"pdf":"https://restapi.e-conomic.com/invoices/drafts/2/pdf","salesDocumentType":"draftInvoice","self":"https://restapi.e-conomic.com/invoices/drafts/2","metaData":{"book":{"description":"Book a draft invoice.","href":"https://restapi.e-conomic.com/invoices/booked","httpMethod":"post"},"bookWithNumber":{"description":"Book a draft invoice on a specific invoice number.","href":"https://restapi.e-conomic.com/invoices/booked/:bookingNumber","httpMethod":"put"},"delete":{"description":"Delete this draft invoice.","href":"https://restapi.e-conomic.com/invoices/drafts/2","httpMethod":"delete"},"replace":{"description":"Replace this draft invoice.","href":"https://restapi.e-conomic.com/invoices/drafts/2","httpMethod":"put"},"update":{"description":"Update a subset of properties on this invoice.","href":"https://restapi.e-conomic.com/invoices/drafts/2","httpMethod":"patch"}}}'

 

I can also create/update customers using PUT, but when I try creating an invoice I cannot seem to get the right format for the JSON, i get the error 

 "errorCode": "E04010",

"exceptionMessage_WillBeHiddenSoon": "DebtorName cannot be null."

 
no matter what I do, example:
 
curl -ki -H"appId: SECRET9HUX9v981" -H"accessId: SECRETCgvVvKUx-V6ow1" -H"Content-Type: application/json" https://restapi.e-conomic.com/invoices/drafts -X  POST -d'{"lines":[{"unitId":2,"quantity":22,"unitPrice":"40000.00","product":{"name":"Aconto rate 1, 100% af 40.000,00"}}],"currencyExchangeRate":100,"customer":{"customerNumber":823326,"currency":"DKK","paymentTerms":{"paymentTermsNumber":2,"self":"https://restapi.e-conomic.com/payment-terms/2"},"customerGroup":{"customerGroupNumber":0,"self":"https://restapi.e-conomic.com/customer-groups/1"},"vatZone":"HomeCountry","address":"TESTgade","city":"TESTBY","country":"Denmark","barred":false,"name":"TESTFIRMA","zip":"8560 ","email":"kontor@email.dk","self":"https://restapi.e-conomic.com/customers/823326"},"date":"2014-07-11","currency":"DKK","vatIncluded":true}'

 

anyone got this working? or do you have a minimal example of a working JSON invoice?

spurgt 15 Aug, 2014 i Spørgsmål » e-conomic generelt af fh_at_ipwsystems.dk (190 points)

2 Svar

 
Bedste svar

Hi

We have a forum for API questions - could I get you to create the topic in here

I'm sure you will get alot of better response from that forum.

This forum is mainly for ideas for new features and questions regarding existing features, so the API-forum will be a much better place to search for this kind of help. :)


Med venlig hilsen

Philip Kofod-Nielsen

Online regnskabsprogram
 

besvaret 15 Aug, 2014 Spørgsmål af Philip Kofod-Nielsen (17,700 points)
valgt som bedste svar 15 Aug, 2014 af fh_at_ipwsystems.dk
Ahh yes, thanks, just did that :)
besvaret 15 Aug, 2014 Spørgsmål af fh_at_ipwsystems.dk (190 points)
i gang× 1
Vi sætter stor pris på alle de forslag vi løbende får ind, og vi gør hvad vi kan, for at få implementeret så mange som muligt.

Når vi udvælger, hvilke forslag der skal udvikles og implementeres, sker det ved prioritering efter hvilke der giver størst værdi for flest brugere, samt afstemning blandt brugerne. Et forslag er altså ikke garanteret udvikling og kan således blive fravalgt i processen. Med andre ord; DIN mening tæller!

Når vi modtager et forslag sker der følgende:
  • Forslaget gennemlæses, besvares og tagges med “Overvejes”
  • Forslaget er nu klar til at modtage stemmer fra andre brugere
  • Der tages stilling til, om forslaget bliver udført og det tagges derefter som “Planlagt”