require 'vendor/autoload.php';
// Create a client to work with Skopenow API
$skopenow = new GuzzleHttpClient(
[
'base_uri' => 'https://api.skopenow.com/v1/',
'headers' => [
'Content-Type' => 'application/json',
'x-api-key' => 'API-KEY-HERE',
]
]
);
try {
// Test Search
$request = [
"inputs" => [
"name" => ["Robert James"],
"location" => ["Oyster Bay, NY"]
],
"output" => [
"type" => "json",
"destination" => "url",
"url" => "http://requestb.in/123456"
]
];
$response = $skopenow->post("search", ['json' => $request]);
echo $response->getBody();
} catch (Exception $e) {
// Failed
echo $e->getMessage();
}
curl -X POST -H "x-api-key: API-KEY-HERE" -H "Content-Type: application/json" -d '{
"inputs" : {
"name" : ["Robert James"],
"location" : ["Oyster Bay, NY"]
},
"output" : {
"type" : "json",
"destination" : "url",
"url": "http://requestb.in/123456"
}
}' "https://api.skopenow.com/v1/search"
var rest = require('restler');
var skopenow = new rest.Service({
baseURL: 'https://api.skopenow.com/v1/',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'API-KEY-HERE',
}
});
// Test Search
var request = {
"inputs": {
"name": ["Robert James"],
"location": ["Oyster Bay, NY"]
},
"output": {
"type": "json",
"destination": "url",
"url": "http://requestb.in/123456"
}
};
skopenow.json("POST","search", request).on('success', function(data, response) {
// Succeeded
console.log(data)
}).on('error', function(err, response) {
// Failed
console.log(err);
});