I want to send non-GPS context with a variable and I believe the format would look like this:
{
"Moisture": "{{Moisture}}",
"Watering": {
"value": "{{Watering}}",
"context": "{{status}}"
},
"SoilTemp": "{{SoilTemp}}"
}
```
I have tested a JSON body for this structure and believe this is valid:
```
{"SoilTemp":"19","Watering":{"value": "0", "context": "Oops"},"Moisture":"516"}'
```
but when try to send using a curl command I get a response that I cannot figure out:
```
{"watering": [{"status_code": 400, "errors": {"context": ["'Oops' value must be a dict."]}}], "soiltemp": [{"status_code": 204}], "moisture": [{"status_code": 204}]}
```
I could not find a reference to error code 204 in the response code documentation and I could find no reference to ""'Oops' value must be a dict."". Can you please tell me what I am doing wrong.
Thank you for any help you might be able to provide.
Chip
As I can see on the requests you are building in a wrong way your context, the context is a key-value dictionary, so your payload should be something like this:
I was able to get it to work and was able to upload the datapoints, getting the 201 response code.
Please see the cross-linked post on Particle. Even though the data has been uploaded, it is not showing up under “context” for the Watering variable. How do I display this data?
Keep in mind that with the payload provided, the only variable with context data is “Watering” so that is the one that you should check. Can you try again?