JSON NXSL
-
Hi,
Working on integration NetXMS with GLPI using RestAPI and web service definitions. Everything is working except i can not get a handle arround the JSON response.
Is there no support for JSON arrays in NXSL functions?
For example i have this response and i want to loop these values and count total
[ { "id": 178 }, { "id": 179 }, { "id": 181 } ] -
-
Yes, there is json support in nxsl, there is JsonParse() which would produce JsonObject or JsonArray. Support for jsons which have array at the root level (which is the case in your example) was added just recently, it will be available in next patch release. So after that release is out you could do something like this:
s = """[ { "id": 178 }, { "id": 179 }, { "id": 181 } ]"""; p = JsonParse(s); println(classof(p)); count = 0; for (v: p->values) { println(classof(v)); count = count + v->get("id"); } println(count);which would produce the following:
Result: JsonArray JsonObject JsonObject JsonObject 538 *** FINISHED *** -
-
Try putting the token into password field for Bearer authentication. Pls give us an update, if this works.
-
-
This message indicates that agent was built with libcurl without bearer authentication support. On what platform you run agent and how did you install it?
-
-
Looks like it's missing in Windows builds. I've created an issue for this, so one day developers will have a look.
Meanwhile you can put netxms agent on any linux machine and configure it as a proxy - token support should be working on Linux.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login