What does it actually do?
I have a table SQLUser.Person for example, it returns nothing.
- Log in to post comments
What does it actually do?
I have a table SQLUser.Person for example, it returns nothing.
Try application/xml instead of text/xml for content type.
If it does not help, check API docs for correct type.
For accept try */*.
I think I encountered something similar. I added to target class:
Class Proxy.Class Extends (%Persistent, %XML.Adaptor) {
Parameter XMLIGNOREINVALIDTAG =1;
Parameter XMLIGNOREINVALIDATTRIBUTE= 1;
...
}And it helped.
I mean response body may contain additional info
print(response.content)Check response with 500 error code, it probably contains error information
201 looks like a correct response.
500 on the other hand is an error. Check what's the error.
What's the status_code on
response = session.post(getPropertyUrl(property), params= {"type":"%Numeric", "path": property, "unique":0}, headers=header) print(response.status_code)
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 code
You need to cycle over all properties, so +2 lines probably.
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())
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.
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
Awesome. Didn't know about it.
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.
When you get sc=1 , what about:
set resp=httpRequest.HttpResponsezw resp do resp.Data.OutputToDevice()
Compare output of
Set sc = httpRequest.Post("/sample/", 1)with what Postman sends.
Also, what does
Set sc = httpRequest.Post("/sample/")
zw scshow?
Probably. What setting do you need to modify?
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?
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
}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.
The easiest solution would be
set net.SSLCheckServerIdentity=0
that disables server cert checking. Not very secure obviously.
What's the use case by the way?
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.
Please post code to reproduce the issue?
Check your current server locale.
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.
Yes, it would work.
Thank you, Luca!
You can use methods of %Activate.TLEnumerator class to load libraries programmatically.
I think you'll need a full fledged orchestrator for that. Docker run always starts one container, bit several volumes could be mounted, some of them RW, some RO. I'm not sure about mounting the same folder into several containers (again, orchestration).
You can also use volumes_from argument to mount directory from one container to another.