Difference between revisions of "Offerit REST API Get Global Host and Post Ips"
From Offerit
OfferitRob (talk | contribs) |
OfferitRob (talk | contribs) |
||
| Line 31: | Line 31: | ||
*Response: | *Response: | ||
<pre> | <pre> | ||
| − | + | { | |
| + | "result": "success", | ||
| + | "data": [ | ||
| + | "2001:1af8:4e00:a018:6::10", | ||
| + | "73.279.112.30" | ||
| + | ] | ||
| + | } | ||
| + | |||
| + | { | ||
| + | "result": "error", | ||
| + | "data": "Invalid ip" | ||
| + | } | ||
</pre> | </pre> | ||
| Line 41: | Line 52: | ||
$curl = curl_init(); | $curl = curl_init(); | ||
| − | $data = array( | + | $data = array(); |
| − | |||
| − | ); | ||
$url = 'https://domain/api/config/get_global_post_ips'; | $url = 'https://domain/api/config/get_global_post_ips'; | ||
Revision as of 16:12, 26 July 2022
GET /config/get_global_post_ips
Description
- The api/config/get_global_post_ips action is allows retrieval of the Global Post Ip list (Config -> Security, Global Postback Allowed IPs)
Resource URL
- https://domain/api/config/get_global_post_ips
- Replace domain with the Offerit domain
- GET
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
Example Request
GET
https://domain/api/config/get_global_post_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_post_ips';
$headers = array(
'api-key: 44b5498dbcb481a0d00b404c0169af62',
'api-username: offerit_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);
?>