Difference between revisions of "Offerit REST API Get Global Host and Post Ips"

From Offerit
Jump to: navigation, search
Line 1: Line 1:
{{Offerit Manual
+
{{NATS for Networks Manual
 
| show_rest_api_section = true
 
| show_rest_api_section = true
 
}}
 
}}
== '''GET /config/get_global_post_ips''' ==
+
== '''GET /config/get_global_hostnpost_ips''' ==
 
'''Description'''  
 
'''Description'''  
*The  api/config/get_global_post_ips action is allows retrieval of the Global Post Ip list (Config -> Security, Global Postback Allowed IPs)
+
*The  api/config/get_global_hostnpost_ips action is allows retrieval of the Global Post Ip list (Config -> Security, Global Host and Post Allowed IPs)
  
 
'''Resource URL'''
 
'''Resource URL'''
*<nowiki>https://domain/api/config/get_global_post_ips</nowiki>
+
*<nowiki>https://domain/api/config/get_global_hostnpost_ips</nowiki>
*Replace domain with the Offerit domain
+
*Replace domain with the NATS for Networks domain
  
'''[[Offerit_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']]
+
'''[[NATS_For_Networks_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']]
 
*GET
 
*GET
  
Line 16: Line 16:
 
*JSON
 
*JSON
  
'''[[Offerit_REST_API_Overview#Authentication|Authentication]]'''
+
'''[[NATS_For_Networks_REST_API_Overview#Authentication|Authentication]]'''
 
*HTTP headers
 
*HTTP headers
  
Line 27: Line 27:
 
'''GET'''
 
'''GET'''
  
<nowiki>https://domain/api/config/get_global_post_ips</nowiki>
+
<nowiki>https://domain/api/config/get_global_hostnpost_ips</nowiki>
  
 
*Response:  
 
*Response:  
Line 54: Line 54:
 
$data = array();
 
$data = array();
  
$url = 'https://domain/api/config/get_global_post_ips';
+
$url = 'https://domain/api/config/get_global_hostnpost_ips';
  
 
$headers = array(
 
$headers = array(
 
     'api-key: 44b5498dbcb481a0d00b404c0169af62',
 
     'api-key: 44b5498dbcb481a0d00b404c0169af62',
     'api-username: offerit_admin'
+
     'api-username: admin'
 
);
 
);
 
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
 
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
Line 76: Line 76:
  
  
[[Category:Offerit API Articles]]
+
[[Category:NATS For Networks API Articles]]

Revision as of 17:54, 28 July 2022

Template:NATS for Networks Manual

GET /config/get_global_hostnpost_ips

Description

  • The api/config/get_global_hostnpost_ips action is allows retrieval of the Global Post Ip list (Config -> Security, Global Host and Post Allowed IPs)

Resource URL

  • https://domain/api/config/get_global_hostnpost_ips
  • Replace domain with the NATS for Networks domain

Request Method

  • GET

Response Format

  • JSON

Authentication

  • HTTP headers

Parameters

Parameters must be sent with the request body. The examples below show the parameters sent as x-www-form-urlencoded


Example Request

GET

https://domain/api/config/get_global_hostnpost_ips

  • Response:
{
    "result": "success",
    "data": [
        "2001:1af8:4e00:a018:6::10",
        "73.279.112.30"
    ]
}

{
    "result": "error",
    "data": "Invalid ip"
}

Example Code

PHP

<?php
$curl = curl_init();

$data = array();

$url = 'https://domain/api/config/get_global_hostnpost_ips';

$headers = array(
    'api-key: 44b5498dbcb481a0d00b404c0169af62',
    'api-username: admin'
);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
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);
?>