Copy to Clipboard CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: <SOME_STRING_VALUE>");
headers = curl_slist_append(headers, "authorization: <SOME_STRING_VALUE>");
headers = curl_slist_append(headers, "apikey: <SOME_STRING_VALUE>");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}");
CURLcode ret = curl_easy_perform(hnd);
Copy to Clipboard (require '[clj-http.client :as client])
(client/post "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query" {:headers {:authorization "<SOME_STRING_VALUE>"
:apikey "<SOME_STRING_VALUE>"}
:content-type :json
:form-params {:filters []
:sorting []
:paging {:pageNumber 0
:pageSize 0}}})
Copy to Clipboard var client = new RestClient("https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "<SOME_STRING_VALUE>");
request.AddHeader("authorization", "<SOME_STRING_VALUE>");
request.AddHeader("apikey", "<SOME_STRING_VALUE>");
request.AddParameter("undefined", "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Copy to Clipboard package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query"
payload := strings.NewReader("{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<SOME_STRING_VALUE>")
req.Header.Add("apikey", "<SOME_STRING_VALUE>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Copy to Clipboard POST /wcregister/v1/licence/search/query HTTP/1.1
Authorization: <SOME_STRING_VALUE>
Apikey: <SOME_STRING_VALUE>
Host: api.onegov.nsw.gov.au
Content-Length: 66
{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}
Copy to Clipboard OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}");
Request request = new Request.Builder()
.url("https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query")
.post(body)
.addHeader("authorization", "<SOME_STRING_VALUE>")
.addHeader("apikey", "<SOME_STRING_VALUE>")
.build();
Response response = client.newCall(request).execute();
Copy to Clipboard HttpResponse<String> response = Unirest.post("https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query")
.header("authorization", "<SOME_STRING_VALUE>")
.header("apikey", "<SOME_STRING_VALUE>")
.body("{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}")
.asString();
Copy to Clipboard var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query",
"method": "POST",
"headers": {
"authorization": "<SOME_STRING_VALUE>",
"apikey": "<SOME_STRING_VALUE>"
},
"processData": false,
"data": "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Copy to Clipboard fetch("https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query", {
"method": "POST",
"headers": {
"authorization": "<SOME_STRING_VALUE>",
"apikey": "<SOME_STRING_VALUE>"
},
"body": {
"filters": [],
"sorting": [],
"paging": {
"pageNumber": 0,
"pageSize": 0
}
}
})
.then(response => {
console.log(response);
})
.catch(err => {
console.log(err);
});
Copy to Clipboard var data = JSON.stringify({
"filters": [],
"sorting": [],
"paging": {
"pageNumber": 0,
"pageSize": 0
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query");
xhr.setRequestHeader("authorization", "<SOME_STRING_VALUE>");
xhr.setRequestHeader("apikey", "<SOME_STRING_VALUE>");
xhr.send(data);
Copy to Clipboard var http = require("https");
var options = {
"method": "POST",
"hostname": "api.onegov.nsw.gov.au",
"port": null,
"path": "/wcregister/v1/licence/search/query",
"headers": {
"authorization": "<SOME_STRING_VALUE>",
"apikey": "<SOME_STRING_VALUE>"
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({filters: [], sorting: [], paging: {pageNumber: 0, pageSize: 0}}));
req.end();
Copy to Clipboard var request = require("request");
var options = {
method: 'POST',
url: 'https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query',
headers: {
'content-type': '<SOME_STRING_VALUE>',
authorization: '<SOME_STRING_VALUE>',
apikey: '<SOME_STRING_VALUE>'
},
body: {filters: [], sorting: [], paging: {pageNumber: 0, pageSize: 0}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Copy to Clipboard var unirest = require("unirest");
var req = unirest("POST", "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query");
req.headers({
"content-type": "<SOME_STRING_VALUE>",
"authorization": "<SOME_STRING_VALUE>",
"apikey": "<SOME_STRING_VALUE>"
});
req.type("json");
req.send({
"filters": [],
"sorting": [],
"paging": {
"pageNumber": 0,
"pageSize": 0
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
Copy to Clipboard #import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"authorization": @"<SOME_STRING_VALUE>",
@"apikey": @"<SOME_STRING_VALUE>" };
NSDictionary *parameters = @{ @"filters": @[ ],
@"sorting": @[ ],
@"paging": @{ @"pageNumber": @0, @"pageSize": @0 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
Copy to Clipboard open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query" in
let headers = Header.add_list (Header.init ()) [
("authorization", "<SOME_STRING_VALUE>");
("apikey", "<SOME_STRING_VALUE>");
] in
let body = Cohttp_lwt_body.of_string "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
Copy to Clipboard <?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}",
CURLOPT_HTTPHEADER => array(
"apikey: <SOME_STRING_VALUE>",
"authorization: <SOME_STRING_VALUE>",
"content-type: <SOME_STRING_VALUE>"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Copy to Clipboard <?php
$request = new HttpRequest();
$request->setUrl('https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'content-type' => '<SOME_STRING_VALUE>',
'authorization' => '<SOME_STRING_VALUE>',
'apikey' => '<SOME_STRING_VALUE>'
));
$request->setBody('{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Copy to Clipboard <?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}');
$request->setRequestUrl('https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders(array(
'content-type' => '<SOME_STRING_VALUE>',
'authorization' => '<SOME_STRING_VALUE>',
'apikey' => '<SOME_STRING_VALUE>'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
Copy to Clipboard $headers=@{}
$headers.Add("content-type", "<SOME_STRING_VALUE>")
$headers.Add("authorization", "<SOME_STRING_VALUE>")
$headers.Add("apikey", "<SOME_STRING_VALUE>")
$response = Invoke-WebRequest -Uri 'https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query' -Method POST -Headers $headers -ContentType 'undefined' -Body '{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}'
Copy to Clipboard $headers=@{}
$headers.Add("content-type", "<SOME_STRING_VALUE>")
$headers.Add("authorization", "<SOME_STRING_VALUE>")
$headers.Add("apikey", "<SOME_STRING_VALUE>")
$response = Invoke-RestMethod -Uri 'https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query' -Method POST -Headers $headers -ContentType 'undefined' -Body '{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}'
Copy to Clipboard import http.client
conn = http.client.HTTPSConnection("api.onegov.nsw.gov.au")
payload = "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}"
headers = {
'authorization': "<SOME_STRING_VALUE>",
'apikey': "<SOME_STRING_VALUE>"
}
conn.request("POST", "/wcregister/v1/licence/search/query", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Copy to Clipboard import requests
url = "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query"
payload = "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}"
headers = {
'authorization': "<SOME_STRING_VALUE>",
'apikey': "<SOME_STRING_VALUE>"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
Copy to Clipboard require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["authorization"] = '<SOME_STRING_VALUE>'
request["apikey"] = '<SOME_STRING_VALUE>'
request.body = "{\"filters\":[],\"sorting\":[],\"paging\":{\"pageNumber\":0,\"pageSize\":0}}"
response = http.request(request)
puts response.read_body
Copy to Clipboard curl --request POST \
--url https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query \
--header 'apikey: <SOME_STRING_VALUE>' \
--header 'authorization: <SOME_STRING_VALUE>' \
--header 'content-type: <SOME_STRING_VALUE>' \
--data '{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}'
Copy to Clipboard echo '{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}' | \
http POST https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query \
apikey:'<SOME_STRING_VALUE>' \
authorization:'<SOME_STRING_VALUE>'
Copy to Clipboard wget --quiet \
--method POST \
--header 'authorization: <SOME_STRING_VALUE>' \
--header 'apikey: <SOME_STRING_VALUE>' \
--body-data '{"filters":[],"sorting":[],"paging":{"pageNumber":0,"pageSize":0}}' \
--output-document \
- https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query
Copy to Clipboard import Foundation
let headers = [
"authorization": "<SOME_STRING_VALUE>",
"apikey": "<SOME_STRING_VALUE>"
]
let parameters = [
"filters": [],
"sorting": [],
"paging": [
"pageNumber": 0,
"pageSize": 0
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api.onegov.nsw.gov.au/wcregister/v1/licence/search/query")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()