10-19-2020 08:40 AM
Hello,
I'm having problem POSTing data when the PATH is nested from the main path.The structure of the JSON file is like this:
{
"dev1": [ ],
"dev2": [ ],
"sensor": [
{
"sen1": [ ],
"sen2": [ ]
}
],
"configuration": [
{
"dev1": { },
"dev2": { },
"sen1": { },
"sen2": { }
}
]
}
Posting data from device1 and device2 (dev1 & dev2) works fine. However, when I try posting data from sensor 1, it fails. I don't know if the problem is the path.
I'm using LabVIEW 2020 with JKI tools - HTTP REST Client.
Thanks in advance.
10-19-2020 10:23 AM
Haven't worked with any of this, but "sensor" is an array of "clusters" ({sen1,sen2}).
So either POST both sen1 and sen2 in a cluster togehter to "sensors", change your definition (remove brackets in sensor definition) or try something like sensors/1/sen1, although I'm not sure the latter will work.
07-20-2023 05:34 AM
Hi,
did you come to a solution for this?
07-20-2023 06:40 AM
The URL he POSTs to does not exist, the POST code is 404 (not found).
The endpoint "/dev1" exists, but "/sen1" does not.
If I am understanding the JSON Server readme about nested ressources correctly, it should be possible to post to "/sensors/1/sen1"