Difference between revisions of "NATS For Networks REST API Add Global Void Ip"
From TMM Wiki
Jump to navigationJump to search (Created page with "{{NATS for Networks Manual | show_rest_api_section = true }} == '''GET /config/add_global_void_ip''' == '''Description''' *The api/config/add_global_void_ip action adds a val...") |
|||
Line 2: | Line 2: | ||
| show_rest_api_section = true | | show_rest_api_section = true | ||
}} | }} | ||
− | == ''' | + | == '''POST /config/add_global_void_ip''' == |
'''Description''' | '''Description''' | ||
*The api/config/add_global_void_ip action adds a valid ip to the Config->Security->Global Void Ip list | *The api/config/add_global_void_ip action adds a valid ip to the Config->Security->Global Void Ip list | ||
Line 11: | Line 11: | ||
'''[[NATS_For_Networks_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']] | '''[[NATS_For_Networks_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']] | ||
− | * | + | *POST |
'''Response Format''' | '''Response Format''' |
Latest revision as of 18:10, 1 August 2022
POST /config/add_global_void_ip
Description
- The api/config/add_global_void_ip action adds a valid ip to the Config->Security->Global Void Ip list
Resource URL
- https://domain/api/config/add_global_void_ip
- Replace domain with the NATS for Networks domain
- POST
Response Format
- JSON
- HTTP headers
Parameters
Parameters must be sent with the request body. The examples below show the parameters sent as x-www-form-urlencoded
- ip
- type: string
- required
- ipv4 or ipv6 format
Example Request
POST
https://domain/api/config/add_global_void_ip
- Response:
{ "result": "success", "data": "Ip added / Ip already in list" } { "result": "error", "data": "Invalid ip" }
Example Code
PHP
<?php $curl = curl_init(); $data = array( ip' => '73.279.112.30', ); $url = 'https://domain/api/config/add_global_void_ip'; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: admin' ); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($curl, CURLOPT_URL, $url); $resp = curl_exec($curl); //dumps an associative array representation of the json var_dump(json_decode($resp, true)); // Close request to clear up some resources curl_close($curl); ?>