Reply
Accepted Solution

REST API bug for record:ptr

[ Edited ]
Authority
Posts: 18
4566     0

Hello,

I think I ran into an unexpected behaviour of the REST API.

 

This call:

 

$ curl -s -S -k -u admin:infoblox \
  -H "Content-Type: application/json" \
  -X POST https://infoblox.example.com/wapi/v2.2/record:ptr \
  -d '{ \
    "name": "marco.example.com", \
    "ptrdname": "marco.example.com", \
    "ipv4addr": "10.36.241.14", \
    "view": "default" \
  }'
"record:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5pdC5iYW5raXQudXRlbnplLnRpenpvbmkudGl6em9uaS51dGVuemUuYmFua2l0Lml0:marco.example.com/default"

 

should create a PTR record in the reverse zone 10.in-addr.arpa, instead it creates a PTR record in the example.com forward zone, the last part of the record reference shows that.

After a bit of troubleshooting I found that the very same call with a TTL specified would create the correct record:

 

 

$ curl -s -S -k -u admin:infoblox \
  -H "Content-Type: application/json" \
  -X POST https://infoblox.example.com/wapi/v2.2/record:ptr \
  -d '{ \
    "name": "marco.example.com", \
    "ptrdname": "marco.example.com", \
    "ipv4addr": "10.36.241.14", \
    "view": "default", \
    "ttl": 14000
  }'
"record:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5hcnBhLmluLWFkZHIuMTAuMzYuMjQxLjE0LmVsaTE2Ny51dGVuemUuYmFua2l0Lml0:14.241.36.10.in-addr.arpa/default".

 

WAPI version is 2.2 (1.2 has the same behaviour), NIOS version is 7.2.3.

 

Is it a bug or a feature?

 

Best,

Marco

Re: REST API bug for record:ptr

[ Edited ]
Adviser
Posts: 43
4567     0

 

Simply take out the "name" attribute in your request:
 
E.g.
 
curl -s -S -k -u admin:infoblox \
>   -H "Content-Type: application/json" \
>   -X POST https://10.10.100.51/wapi/v2.2/record:ptr \
>   -d '{"ptrdname": "marco.test.com","ipv4addr": "10.36.241.14","view": "default"}'
"record:ptr/ZG5zLmJpbmRfcHRyJC5fZGVmYXVsdC5hcnBhLmluLWFkZHIuMTAuMzYuMjQxLjE0Lm1hcmNvLnRlc3QuY29t:14.241.36.10.in-addr.arpa/default"

 

Re: REST API bug for record:ptr

Authority
Posts: 18
4567     0

That works. Can you explain the rationale if any? I am trying to better understand how WAPIs work.

Re: REST API bug for record:ptr

Adviser
Posts: 43
4567     0

Per the WAPI documentation:

 

name

name

The name of the DNS PTR record in FQDN format.

Type

String.

Values with leading or trailing whitespace are not valid for this field.

Create

The field is required only for an PTR object in Forward Mapping Zone.

Search

The field is searchable via

  • ‘:=’ (case insensitive search)
  • ‘=’ (exact equality)
  • ‘~=’ (regular expression)

 

The Perl API doc has a little more context on why you might want to do this:

 

In a forward-mapping zone, a PTR (pointer) record maps a domain name to another domain name. In a reverse-mapping zone, a PTR (pointer) record maps an address to a domain name. To define a specific address-to-name mapping, add a PTR record to a previously defined authoritative reverse-mapping zone.

To create a PTR record, you need to specify a domain name and host name.

Note that you must specify only one view for the attribute "views".

Re: REST API bug for record:ptr

Authority
Posts: 18
4567     0

I see your point and I learnt something new so thanks Smiley Happy still this behaviour looks weird to me.

The name attribute is not required but, if specified, the behaviour of the remote call changes  if a TTL was set or not.

Showing results for 
Search instead for 
Do you mean 

Recommended for You