0

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 PATCH and DELETE method (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/services

I 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/youtube

Ideally 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/services

with 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

1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • 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?

    Like
Like Follow
  • 7 days agoLast active
  • 1Replies
  • 35Views
  • 2 Following