Check this post to see how you can access all levels of dynamic object.
- Log in to post comments
Check this post to see how you can access all levels of dynamic object.
Try
C:\InterSystems\Cache\bin\cache.exe -s C:\InterSystems\Cache\mgr -U %%SYS C:\Users\Zdenda\Desktop\run.script Well, show your cmd script (as text) and ObjectScript script.
You need to either escape your command or use a separate file for a script. I recommend a file.
I've got minimal security settings
Then you don't need to provide user and password.
I can use this method right
Login(Username As %String , Password As%String )?
No. First line of script - user, second line - password. After that - ObjectScript.
Do $system.OBJ.Load("Installer.xml", "c") I dont know why.
Try full path. Also this method returns status, check it:
Set sc = $system.OBJ.Load("/path/to/Installer.xml", "c")
Write:('sc) $System.Status.GetErrorText(sc) First two lines of your script should probably be user and password, unless you're running a minimal security install or enabled OS authentication.
ObjectScript code after that, yes, sothis looks correct
do ##class(User.Installer).setup() Maybe you need to load User.Installer beforehand?
Use $system.OBJ.Load(file, "c") to load and compile class(es) you need.
Sure
csession {INSTANCE} -U{NAMESPACE} < {SCRIPT}Script contains code you want to execute, in your case the call to installer manifest. It could be a file or just the code itself.
A series of articles about automating CI/CD.
Fixed some issues in REST, but you have license problem.
ClassMethod CreateCoffee() As %Status
{
s json = {}.%FromJSON(%request.Data)
s CoffeeProp = ##class(User.PropertyName).%New()
s CoffeeProp.CoffeeName= json.CoffeeName
s CoffeeProp.CoffeeColor=json.CoffeeColor
s CoffeeProp.CoffeePrice= json.CoffeePrice
s Status = CoffeeProp.%Save()
}Use ccontrol qlist to get structured information about available instances.
ccontrol qlist [<instance>] [nodisplay > outputfile]
Display a quick list of information about all installed instances, in a format suitable for parsing in command scripts.
The record for an instance contains fields separated by "^" (carats):
How is it valid JSON?
1. JSON accepts only double quotes. Single quotes are not valid.
2. Property names must be quoted (in double quotes). error/txt are not quoted.
Here's JSON standard.
Use custom resources.
Should be
If glo["ABC",type="K" Set restmode=0 /*except if a kill on ^ABC*/ Instead of
If glo["^ABC",type="K" Set restmode=0 /*except if a kill on ^ABC*/ Globals can't have duplicate keys.
After I execute your code and call
zw ^Data I get this output:
^Data("Athens")=7
^Data("Boston")=3
^Data("Cambridge")=1
^Data("London")=4
^Data("New York")=2Please post CROSRestAPI as text.
Can you get InterSystems IRIS or a complete version of Cache/Ensemble?
Service Unavailable error is because of license limitations on TRYCACHE.
Create a response wrapper and use it. %ListOfObjects is serial, not persistent.
Class MyResponse Extends %Persistent {
Property Snapshots As List Of EnsLib.SQL.Snapshot;
}Well, maybe it's a handwritten response?
I'd recommend contacting the API developer and verifying that API responses would be indeed JSON.
Can you make the same call to the API using Postman and show the response?
It's very strange that API returns non-json response.
Does my code snippet throw the same error?
You can simplify your code to this:
set dynObj = {}.%FromJSON(objHttpResponse.Data)
set iter = dynObj.%GetIterator()
while iter.%GetNext(.key , .value ) {
write "key = "_key_" , value = "_value,!
}Also json is a string so in your code sample it won't have %FromJSON method.
Well, the JSON you posted is not a valid JSON. Where did you get it?
Valid JSON looks like this:
{
"error":[
{
"txt1":"error msg1"
},
{
"txt2":"error msg2"
}
]
}What version are you on?
If it's 2016.2+ you can use dynamic objects.
Variables are local to the process.
1.Variables are defined or referenced via <var>, yes, but you can pass the values to the Installer from your script. For example, check MDX2JSON installer:
Set pVars("User")="web"
Set pVars("Password")="dsweb"
Set pVars("Namespace")="TEMP3"
Set pVars("Import")=1
Set pVars("SourceDir")="C:\temp\MDX2JSON\MDX2JSON"
Do ##class(MDX2JSON.Installer).setup(.pVars)2. You set environment variable in cmd (Windows):
set NEWVAR=SOMETHINGAnd after that you can get it from installer with:
$system.Util.GetEnviron("NEWVAR")1. You can pass variables to installation manifest.
2. You can set environment variables and get them in ObjectScript:
set env = "MYVAR"
set val = $system.Util.GetEnviron(env)They go through your web server (i.e. Apache, NodeJS, IIS) directly.
You can serve files via REST, from files or XDatas. Here's an example in WebTerminal app, but it can be generalized to server arbitrary files from FS.
That would work only in the cases where original reference to OREF exists, right?
i was able to convert the HttpResponse.Data to String and than to the Dynamic Object
You don't need to convert to string, pass stream to FromJSON method and it would work.
send a JSON data to a REST API.
Set tAge = 23
Set pRequest= {"name":"abcdefghi","salary":123,"age":(tAge) }What version are you on? If 2016.2+ then you can convert JSON stream to dynamic object via:
set dynObj = {}.%FromJSON(req.HttpResponse.Data)