Conduit REST API
- This topic has 2 replies, 2 voices, and was last updated 4 years, 11 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forums › Conduit: AEP Model › Conduit REST API
Good Day –
We have a customer use case where we need to configure LoRaWAN parameters at initial startup, for example, changing the LoRaWAN network mode.
The GET works fine: GET https://127.0.01/api/loraNetwork/network
However, when we try:
POST https://127.0.01/api/loraNetwork/network?public=1
or
POST https://127.0.01/api/loraNetwork/network with a body of {“public”:1},
we get:
{
“code”: 400,
“error”: “Path [network] does not lead to an array”,
“status”: “fail”
}
Any help will be appreciated!
Thanks,
William
In a REST API POST is used to create a resource, i.e. add an item to an array.
To change an existing resource, such as the network collection, PUT should be used.
curl 127.0.0.1/api/loraNetwork/network -X PUT -H "Content-Type: application/json" -d '{"public":1}'
Oops – I realized the mistake after I posted.
Thanks again!
William