netlify/open-api

createDnsRecord always returns error

aidalgol opened this issue · 2 comments

A request like this

curl -H 'Authorization: Bearer deadbeef' \
     --data \
     '{"type":"A",
       "hostname":"junk.example.net",
       "value":"192.168.0.1",
       "ttl":3600,
       "priority":null,
       "weight":null,
       "port":null,
       "flag":null,
       "tag":null}' \
     https://api.netlify.com/api/v1/dns_zones/feedbeef/dns_records/

responds with {"error":"undefined method end_with?’ for nil:NilClass"}`

Upon further experimentation, I have discovered that the Content-Type header needs to be explicitly set by adding the option -H 'Content-Type: application/json'.

Hi @aidalgol,

Thanks for reporting how you fixed this problem!

I believe this is somewhat documented in the API documentation, although this could arguably be better documented:

json

Based on this, I think this issue can be closed. Thanks again!