Help with JSON (JSON Tools Extension by LukeGackle)

The answer I get is this


I need hostid and status their values, that is, 10402 and 0

Error "Segment: Start (93) + length (1) - 1 exceeds text length (57)"

Could you stop making new topics and use the topic you already made. I merged this.

Set the language of app inventor to English and then post your blocks again.

the problem is different

Try something like this , using dictionary blocks

1 Like

sorry, corrected

This is what I used to get value from json string:

the number in the csvPath means the item index in the list.

Yes. it works fine
my code


on execution I get an error
Screenshot_1

API request

{
"jsonrpc": "2.0",
"method": "host.update",
"params": {
    "hostid": "10126",
    "status": 0
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1

}

Answer

{
"jsonrpc": "2.0",
"result": {
    "hostids": [
        "10126"
    ]
},
"id": 1

}

https://www.zabbix.com/documentation/current/manual/api/reference/host/update

I don't need an answer. To avoid getting an error

I used the json response shown above

image

now the response is ?

{ "jsonrpc": "2.0", "result": { "hostids": [ "10126" ] }, "id": 1 }

the fact is that I only need hostid
I don't need hostids

Complete code



After this request, I need hostid and status

After that I don't need answers

In this example, we connect to Zabbix and activate the host or deactivate
How to discard the response in the last two requests?

If this is the anwser you get and you need hostids - for example 10126 and id - for example 1

try

you probably did not understand me

here in this block
I ask the API about the host AE3649PA what is its hostid and status

Next, I need to change its status
if it has status 1, then you need to change it to 0 and vice versa
But after these changes, I receive a response from the API according to the API documentation
https://www.zabbix.com/documentation/current/manual/api/reference/host/update

{
"jsonrpc": "2.0",
"result": {
    "hostids": [
        "10126"
    ]
},
"id": 1

}

I don't need this answer, how can I get rid of it so that there is no error?

Screenshot_1

Since I do not have your json , the best way to see the structure of it and modify blocks according to your needs is jsonparseronline

you again did not understand me.
You work everything right!
But I don't need a response from the API when I changed the host status


How can I not accept this answer?

No more ideas?

If I read your code and complaint right, you are dealing with an overloaded web component, (Internet1?) used for different purposes.

This gets complicated, because you need to set up record keeping in the app to remember what you were doing when you initiated the action that caused this event to fire, perhaps in a global variable.

If you save your purpose in a global variable, that means you would need an if/then/elseif/elseif chain in your completion event to test the global variable you had set and respond (or don't respond) appropriately.

In my apps, I prefer to add multiple components, each for a single purpose (read/update/delete) to take advantage of separate completion events, for simplicity.

Here is a sample app, using multiple TinyWebDB components for a read/update scenario.

1 Like

thank you for sending me to the right thought
I added another web

And everything worked without error

P.S. I forgot to mention that it is important to rename the multiple components in the Designer, to include their purpose in their name. If you don't it will cost you later in confusion.

1 Like

Thank you all very much

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.