API command missing support for path variables
The API command has no way of accepting a path parameter. Take the createDnsRecord command as an example, it requires the path parameter of zone_id
To Reproduce
Steps to reproduce the behavior:
Issue any API command that requires a path variable
Configuration
N/A
netlify api createDnsRecord --data '{ "type": "ns","hostname": "myDomain.com","value": "12345670asjsdfRandpm","ttl": 60}'
Expected behavior
The ability to pass in a required path parameters
CLI Output
Error: Missing required path variable 'zone_id'
Additional context
Add any other context about the problem here.
Thanks @karl-cardenas-coding, could you try passing zone_id as a part of --data, e.g.
netlify api createDnsRecord --data '{ "zone_id": "some-zone-id", "type": "ns","hostname": "myDomain.com","value": "12345670asjsdfRandpm","ttl": 60}'
The CLI uses js-client which should handle that:
https://github.com/netlify/js-client/blob/9d3945c1bb3f8d96b734f3eca1d90c717fa38558/src/methods/url.js#L6
See getSite example https://cli.netlify.com/commands/api which uses a path paremeter:
https://open-api.netlify.com/#operation/getSite
@erezrokah It returns Unprocessable Entity when I add the zone_id
netlify api createDnsRecord --data '{ "zone_id":"123456789","type": "ns","hostname": "myDomain.com","value": "12345670asjsdfRandpm"}'
JSONHTTPError: Unprocessable Entity
You're right though, I tried another command with path parameters netlify api getDnsZone --data '{"zone_id": "1234567890"}' and that worked just fine. So it must be something with my payload.
Thanks for following up @karl-cardenas-coding, can we close this issue?
I would also share the error and payload in https://community.netlify.com/ to see if something is missing.
@erezrokah Yeah we can close, I'll keep tinkering with this. Thanks for looking into this.