var request = require("request");
var options = {
method: 'POST',
url: 'https://x-api.rollout.io/public-api/applications',
headers: {
accept: 'application/json',
'content-type': 'application/json',
authorization: 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
},
body: {applicationName: 'AcmeCorpApp'},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
|
curl --request POST \
--url https://x-api.rollout.io/public-api/applications \
--header 'accept: application/json' \
--header 'authorization: Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6' \
--header 'content-type: application/json' \
--data '{"applicationName":"AcmeCorpApp"}'
|
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://x-api.rollout.io/public-api/applications")
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["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["authorization"] = 'Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6'
request.body = "{\"applicationName\":\"AcmeCorpApp\"}"
response = http.request(request)
puts response.read_body
|
import requests
url = "https://x-api.rollout.io/public-api/applications"
payload = "{\"applicationName\":\"AcmeCorpApp\"}"
headers = {
'accept': "application/json",
'content-type': "application/json",
'authorization': "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
|
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"applicationName\":\"AcmeCorpApp\"}");
Request request = new Request.Builder()
.url("https://x-api.rollout.io/public-api/applications")
.post(body)
.addHeader("accept", "application/json")
.addHeader("content-type", "application/json")
.addHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")
.build();
Response response = client.newCall(request).execute();
|
var client = new RestClient("https://x-api.rollout.io/public-api/applications");
var request = new RestRequest(Method.POST);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6");
request.AddParameter("application/json", "{\"applicationName\":\"AcmeCorpApp\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
|
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://x-api.rollout.io/public-api/applications"
payload := strings.NewReader("{\"applicationName\":\"AcmeCorpApp\"}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("accept", "application/json")
req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "Bearer b0c17g9f-79f4-69da-cc45-67db602c10d6")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
|