PATCHing arrays
Hello,
First up, thanks so much for making the beta API available, i've been wanting for this for ages!
The docs state:
.. for array endpoints "Each child supports the
PATCHandDELETEmethod (you should use the first key as id).
I'm trying to modify the active status of a service under parentalControls, if I issue a GET against
/profiles/:profile/parentalControl/servicesI get an array of objects of the form:
{"id":"youtube","website":"https://www.youtube.com","active":true}Based on the docs I should be able to issue a PATCH against:
/profiles/:profile/parentalControl/services/youtubeIdeally with a body of:
{"active": false}Unfortunately this doesn't appear to work and returns a 400 with the error:
{
  "errors": [
    {
      "code": "type",
      "source": {
        "pointer": ""
      },
      "detail": "`` must be object."
    }
  ]
}I also tried a PATCH against
/profiles/:profile/parentalControl/serviceswith a body containing the full array item but that returns a 404.
Any suggestions on how we should access array endpoints? An example in the docs would also be great.
Thanks
Marcus
3 replies
- 
  The following does indeed work: curl -X PATCH -H "Content-Type: application/json" -H "X-Api-Key: xxx" --data '{"active": false}' "https://api.nextdns.io/profiles/abc123/parentalControl/services/youtube"You may be forgetting the "Content-Type: application/json" header? 
- 
  > curl --data '{"active": false}' -X PATCH -H "Content-Type: application/json" -H "X-Api-Key: xxxxx" "https://api.nextdns.io/profiles/bxxxx/parentalControl/services/youtube" {"errors":[{"code":"notFound"}]}% > curl --data '{"active": true}' -X PATCH -H "Content-Type: application/json" -H "X-Api-Key: xxxxx" "https://api.nextdns.io/profiles/bxxxx/parentalControl/services/youtube" {"errors":[{"code":"notFound"}]}%So I'm having some trouble with this... any clue why its not working ? 
- 
  It works when using the hex codes apperently,... is there an api method to get a list of them all to build a dictionary? > curl -X PATCH -H "Content-Type: application/json" -H "X-Api-Key: xxxx" --data '{"active": true }' "https://api.nextdns.io/profiles/xxxx/parentalControl/services/hex:74696b746f6b"
Content aside
- 
    1
    
      Likes
    
- 3 yrs agoLast active
- 3Replies
- 188Views
- 
    2
    Following
    
