Infoblox’s global team of threat hunters uncovers a DNS operation with the ability to bypass traditional security measures and control the Great Firewall of China. Read about “Muddling Meerkat” and the many other threat actors discovered by Infoblox Threat Intel here.

API & Integration, DevOps,NetOps,SecOps

Reply

How to use "assign_state" to extract the value from an extensible attributes

New Member
Posts: 7
6142     0

I sent the following request 

 

[
{ "method": "GET", "object": "record:srv", "data":{"name":"_sip._tcp.vega.com", "view":"default"},  "args":{"_return_fields+":"extattrs"}, "assign_state": {"ref": "_ref", "ea":"extattrs"}, "discard":true},
{"method": "STATE:DISPLAY"}
]

 

and got such response:

 

[
    {
        "ref": "record:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20udmVnYS9wcml2aWxlZ2UzLTEvMC8wLzUwMDAvdmVnYS5jb20:_sip._tcp.vega.com/default", 
        "ea": {
            "Site": {
                "value": "ABC"
            }
        }
    }
]

My question is how to put the value of the EA "Site" into an variable, so that I can use it in the following request items., such as this:

 

[
{ "method": "GET", "object": "record:srv", "data":{"name":"_sip._tcp.vega.com", "view":"default"},  "args":{"_return_fields+":"extattrs"}, "assign_state": {"ref": "_ref", "ea":"extattrs"}, "discard":true},
{"method": "STATE:DISPLAY"},
{ "method": "PUT", "object": "##STATE:ref:##", "enable_substitution": true, "data":{"extattrs":{
"Site": {"value":"##STATE:ea.Site.value:##"}
}}}

 

what I got now is such an error:

{ "Error": "AdmConProtoError: Variable ea.Site.value not found in the current request state {u'ref': 'record:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20udmVnYS9wcml2aWxlZ2UzLTEvMC8wLzUwMDAvdmVnYS5jb20:_sip._tcp.vega.com/default', u'ea': {'Site': {'value': 'ABC'}}}", 
  "code": "Client.Ibap.Proto", 
  "text": "Variable ea.Site.value not found in the current request state {u'ref': 'record:srv/ZG5zLmJpbmRfc3J2JC5fZGVmYXVsdC5jb20udmVnYS9wcml2aWxlZ2UzLTEvMC8wLzUwMDAvdmVnYS5jb20:_sip._tcp.vega.com/default', u'ea': {'Site': {'value': 'ABC'}}}"
}

 

Re: How to use "assign_state" to extract the value from an extensible attributes

Adviser
Posts: 181
6142     0

Hi,

 

Here is an example from the WAPI document. Let me know if this works for you.

Use a POST request to copy extensible attribute “Building” from an existing network to a new one using “assign_state” to save the value in the state object:

https://1.2.3.4/wapi/v2.9/request

With a body:

[{
   "method": "GET",
   "object": "network",
   "data": {
             "network": "10.1.0.0/16"
           },
   "args": {
             "_return_fields+": "extattrs"
           },
   "assign_state": {
             "ea_value": "*Building"
           },
   "discard": true
},
{
   "method": "POST",
   "object": "network",
   "data": {
             "network": "20.1.0.0/16",
             "extattrs": {
                  "Building": {
                       "value": "##STATE:ea_value:##"
                     }
              }
          },
   "enable_substitution": true
}]

Regards,

Krishna

Re: How to use "assign_state" to extract the value from an extensible attributes

New Member
Posts: 7
6142     0

Thanks a lot, it works well!

Showing results for 
Search instead for 
Did you mean: 

Recommended for You