go to post Eduard Lebedyuk · Sep 8, 2018 It actually doesn't create neither database or property.Check that %Service_DocDB is enabled. Your screenshot also shows that database gets created.if I have 20 properties... this would be a long codeYou need to cycle over all properties, so +2 lines probably.
go to post Eduard Lebedyuk · Sep 8, 2018 Made an erro in URL, it's not .../db/DBName/Propname but .../prop/db/DBName/Propname.Here's a sample code that creates a db and a property. import requests def getBaseUrl(host = "127.0.0.1", port = 52773, namespace = "user", db = "test"): return "http://{}:{}/api/docdb/v1/{}/db/{}" .format(*[host, port, namespace, db]) def getPropertyUrl(property, host = "127.0.0.1", port = 52773, namespace = "user", db = "test"): return "http://{}:{}/api/docdb/v1/{}/prop/{}/{}" .format(*[host, port, namespace, db, property]) def main(): url = getBaseUrl() print(url) header = { 'Content-Type': 'application/json', } session = requests.Session() session.auth = ("_SYSTEM", "SYS") response = session.get(url, headers=header) #response = requests.get(url, headers=header) print(response.status_code) # Number of error if response.status_code == 404: print('DB not found, create DB ...') response = session.post(url, headers=header) print(response.status_code) elif response.status_code != 200: print('Unknown error: ' + response.status_code + ' ' + response.reason) else: property = "Ergebniszuf" # check that property exist response = session.get(getPropertyUrl(property), headers=header) if response.status_code == 404: print('Property not found, creating property: ' + property) response = session.post(getPropertyUrl(property), params= {"type":"%Numeric", "path": property, "unique":0}, headers=header) print(response) elif response.status_code != 200: print('Unknown error: ' + response.status_code + ' ' + response.reason) else: print('DB found, load data...') return 1 if __name__ == '__main__': print(main())
go to post Eduard Lebedyuk · Sep 8, 2018 2012.1.4 has JSON support via %ZEN.proxyObject set obj = ##class(%ZEN.proxyObject).%New() set obj.createTransactionRequest= ##class(%ZEN.proxyObject).%New() set obj.createTransactionRequest.merchantAuthentication = ##class(%ZEN.proxyObject).%New() set obj.createTransactionRequest.merchantAuthentication.name = "gfufet9QVgT5P" do obj.%ToJSON() Also you can use %ZEN.Auxiliary.jsonProvider to convert object into JSON.
go to post Eduard Lebedyuk · Sep 7, 2018 To create one property call: http://127.0.0.1:52773/api/docdb/v1/NamespaceName/db/DBName/propertyName?type=propertyType&path=propertyPath&unique=propertyUnique You'll need one call per property. For your property Ergebniszuf, url would be: http://127.0.0.1:52773/api/docdb/v1/NamespaceName/db/DBName/Ergebniszuf?type=%String&path=Ergebniszuf&unique=0
go to post Eduard Lebedyuk · Sep 7, 2018 Interesting. Check this article - I think you'll need either HTTP Debugging proxy (probably) or Packet analyzer (maybe) to debug this further.As you have reference implementation (Postman) you can start by comparing Postman request/response and Ensemble request/response using HTTP Debugging proxy.
go to post Eduard Lebedyuk · Sep 7, 2018 When you get sc=1 , what about: set resp=httpRequest.HttpResponse zw resp do resp.Data.OutputToDevice()
go to post Eduard Lebedyuk · Sep 7, 2018 Compare output of Set sc = httpRequest.Post("/sample/", 1) with what Postman sends. Also, what does Set sc = httpRequest.Post("/sample/") zw sc show?
go to post Eduard Lebedyuk · Sep 6, 2018 Continuous Delivery - what tools do you use to automate building, testing and deploying your applications? Do you integrate issue tools/messaging/planning and CD tools?
go to post Eduard Lebedyuk · Sep 6, 2018 Just add empty string as is: ClassMethod Test(val = "") { Set t = ##class(Forerun.Test).%New() Do t.ReviewedBy.Insert(val) $$$THROWONERROR(tSC, t.%Save()) Set id = t.%Id() Set user = "me" &SQL(UPDATE Test.Test SET ReviewedBy = ReviewedBy||$ListBuild(:user) WHERE ID=:id ) If SQLCODE<0 Write "Problem",! Quit }
go to post Eduard Lebedyuk · Sep 6, 2018 Usually response does contain status information in StatusCode and StatusLine properties.You need to change this line Set httpResponse = httpRequest.Post("/sample/", 2) to #dim sc As %Status = $$$OK Set sc = httpRequest.Post("/sample/", 2) Write $System.Status.GetErrorText(sc) As Post method returns status. After debugging you can use write $$$ISERR(sc) macro to check if result of some operation is an error.
go to post Eduard Lebedyuk · Sep 6, 2018 The easiest solution would be set net.SSLCheckServerIdentity=0 that disables server cert checking. Not very secure obviously.
go to post Eduard Lebedyuk · Sep 5, 2018 Do you want to change ROWSPEC depending on passed argument?ROWSPEC can be changed on compilation only and it's rather static. At least xDBC clients depend on declared schema/query info and so it cannot be changed dynamically.
go to post Eduard Lebedyuk · Sep 5, 2018 it causes error messages as something in the class is not correct,What error messages?Also try calling zwrite %objlasterror it may contain additional information.