Comments (4)
I investigated further using curl
and CF API documentation & examples. Previously, it was working like this (and that's how the documentation tells us to add DNS records):
curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json" \
--data '{"type":"SRV","name":"_test._tcp.example.org","content":"0 0 1234 server.example.org"}'
This is not the case anymore. The API will return the error:
{
"success": false,
"errors": [
{
"code": 1004,
"message": "DNS Validation Error",
"error_chain": [
{
"code": 9101,
"message": "service is a required data field."
}
]
}
],
"messages": [],
"result": null
}
Seems now there should be an additional data
field inside the JSON, i.e.:
curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records" \
-H "X-Auth-Email: [email protected]" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json" \
--data '{"type":"SRV","name":"_test._tcp.example.org","content":"0 0 1234 server.example.org","data":{"priority":0,"weight":0,"port":1234,"target":"server.example.org","service":"_test","proto":"_tcp","name":"example.org"}}'
This works well, though not documented. Seems this should be changed in cfcli
tool too.
from cloudflare-cli.
This JSON might look a bit redundant, I tested and it seems we can avoid duplication by removing name
and content
fields:
{
"type": "SRV",
"data": {
"service": "_test",
"proto": "_tcp",
"name": "example.org",
"priority": 0,
"weight": 0,
"port": 1234,
"target": "server.example.org"
}
}
It works ok too.
from cloudflare-cli.
Turned out, priority
, weight
and port
can't be of type String
anymore. I've made PR #47 that fixes it.
from cloudflare-cli.
I've also fixed priority parsing, it should be at index 0. In master
it always equals to weight.
from cloudflare-cli.
Related Issues (20)
- Error with node v12.1.0 HOT 2
- Push to Docker Hub HOT 1
- Support API Tokens HOT 7
- Error response received: Invalid request headers HOT 5
- Idempotent DNS Add/Remove HOT 4
- errors on adding DNS A records,please help HOT 3
- cfcli rm is too dangerous! HOT 2
- Error response received: Invalid request headers HOT 5
- Expose DNS record IDs on `ls` and `find` cmds
- [BUG!] Error response when adding numerical-only A records HOT 2
- High severity vulnerability found in musl/musl for Alpine 3.8.2 HOT 1
- Feature request: Support for TLSA records
- Query filters do not work in v4.1.0 HOT 1
- Add command to ban IPs (account)
- Error when communicating with api: Cannot read property 'id' of undefined HOT 1
- Add possibility to change ssl/tls encryption
- Invalid config file: Cannot read properties of null (reading 'account')
- Need a list of required permissions for the API Token
- cfcli add record 0 instead of 000.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloudflare-cli.