Cli: createDnsRecord- JSONHTTPError: Unprocessable Entity

Created on 5 Oct 2020  路  3Comments  路  Source: netlify/cli

Describe the bug

I am seeing some odd behavior with netlify-cli when using the createDnsRecord. It's not accepting my JSON.

To Reproduce

netlify api createDnsRecord --data '{ "zone_id":"5f0008300e71d0b6853aadd4","type": "ns","hostname": "myDomain.com","value": "12345670asjsdfRandpm","ttl": 60}'

I get the following error message JSONHTTPError: Unprocessable Entity

I鈥檓 not sure what is wrong with my payload, because I am able to create the resource when doing a curl command with the same payload

curl --location --request POST 'https://api.netlify.com/api/v1/dns_zones/5f0008300e71d0b6853aadd4/dns_records' \
--header 'Authorization: Bearer xxxxxxxxx \
--header 'Content-Type: application/json' \
--data-raw '{
  "type": "NS",
  "hostname": "myDomain.com",
  "value": "12345670asjsdfRandpm",
  "ttl": 60
}

Configuration

N/A

npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli

npx: installed 1 in 1.369s

  System:
    OS: Linux 4.19 Ubuntu 18.04.5 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
    Memory: 5.97 GB / 12.38 GB
    Container: Yes
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 14.13.0 - /usr/bin/node
    npm: 6.14.8 - /usr/bin/npm
  npmGlobalPackages:
    netlify-cli: 2.63.3

NOTE: This is actually using WSL2

Expected behavior

Expect the CLI to behave as when using the API directly through curl

CLI Output

I get the following error message JSONHTTPError: Unprocessable Entity

Additional context

Add any other context about the problem here.

area api bug

Most helpful comment

adding a link to the community post related to this issue

All 3 comments

I鈥檓 not sure what is wrong with my payload, because I am able to create the resource when doing a curl command with the same payload

Not sure if that is related to the error, but the payload is not the same. The netlify api payload has a lowercase "type": "ns"

@erezrokah It makes no difference unfortunately. I have tried all kinds of different permutations, including playing with ticks and no difference.

adding a link to the community post related to this issue

Was this page helpful?
0 / 5 - 0 ratings