אני מנסה ליצור חשבוניות ב EZCount
עם הAPI שלהם, דרך אקסס VBA
בינתיים הולך קש, לא מצאתי משהו שעובד.
שאלתי:
א. האם יש דרך להבין מתוך האפשרויות שEZcount מחזיר, מה צריך לשנות כדי שיעבוד. (בדקתי ב jsonlint.com שהJSON תקין)
ב. אם לא, האם מישהו יודע על משהו שעובד באקסס בשביל זה?
ג. תחליף. מדובר במערכת שבנויה באקסס כבר כמה שנים, עכשיו רוצים להוסיף חשבוניות. האם יש דרך להכניס משהו חיצוני, תוסף או משהו כזה, שמיוצר בC# או VB שיתקשר עם השרת?. (אאל"ט בעבר דיברו כאן מאפשרות כזאת)
כאן המסמך של הAPI שלהם
זה קוד השליחה:
Function httpPost(url, msg)
With CreateObject("WinHttp.WinHttpRequest.5.1")
.Open "POST", url, False
.setRequestHeader "Content-type", "application/json"
.send msg
httpPost = .responseText
End With
End Function
Sub Test()
Body = "{""api_key"": ""b3b....1"",""developer_email"": ""myMail@gmail.com"",""type"": ""405"",""customer_name"": ""My name"",""payment"": ""[{""payment_type"": ""1"",""date"": ""10/10/2020"",""payment_sum"": ""2""}]""}"
Debug.Print httpPost("https://www.ezcount.co.il/api/createDoc", JsonConverter.ConvertToJson(Body))
End Sub
וזה מה שמתקבל:
"errMsg": "no data sent, please send a GET, POST or JSON request.,known causes for getting this error:, 1.you are using a none SSL connection (http), 2.your JSON is not valid, please validate your json at: jsonlint.com, 3.you are sending a JSON as GET request instead of POST, 4.your request header is not lower case (application\/json) and you are using ASP classic",
"errMsgPretty": [
"no data sent, please send a GET, POST or JSON request.",
"known causes for getting this error:",
" 1.you are using a none SSL connection (http)",
" 2.your JSON is not valid, please validate your json at: jsonlint.com",
" 3.you are sending a JSON as GET request instead of POST",
" 4.your request header is not lower case (application\/json) and you are using ASP classic"
],
"success": false,
"unixtime": 1618412221