driftapi reference implementation
POST
Create Endevent
{{baseUrl}}/game/:game_id/end
QUERY PARAMS
game_id
BODY json
{
"app_version": "",
"game_id": "",
"user_id": "",
"user_name": "",
"time": "",
"data": {
"finished_time": "",
"false_start": false,
"total_score": 0,
"total_driven_distance": "",
"total_driven_time": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/game/:game_id/end");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/game/:game_id/end" {:content-type :json
:form-params {:app_version "V.1.14.15_A"
:game_id "Race1"
:user_name "PlayerNo1"
:data {:false_start false
:total_score 1000
:total_driven_distance 123
:total_driven_time 122}}})
require "http/client"
url = "{{baseUrl}}/game/:game_id/end"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/game/:game_id/end"),
Content = new StringContent("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/game/:game_id/end");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/game/:game_id/end"
payload := strings.NewReader("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/game/:game_id/end HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 215
{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/game/:game_id/end")
.setHeader("content-type", "application/json")
.setBody("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/game/:game_id/end"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/game/:game_id/end")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/game/:game_id/end")
.header("content-type", "application/json")
.body("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}")
.asString();
const data = JSON.stringify({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
total_score: 1000,
total_driven_distance: 123,
total_driven_time: 122
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/game/:game_id/end');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/end',
headers: {'content-type': 'application/json'},
data: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
total_score: 1000,
total_driven_distance: 123,
total_driven_time: 122
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/game/:game_id/end';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1","data":{"false_start":false,"total_score":1000,"total_driven_distance":123,"total_driven_time":122}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/game/:game_id/end',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1",\n "data": {\n "false_start": false,\n "total_score": 1000,\n "total_driven_distance": 123,\n "total_driven_time": 122\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/game/:game_id/end")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/game/:game_id/end',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
total_score: 1000,
total_driven_distance: 123,
total_driven_time: 122
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/end',
headers: {'content-type': 'application/json'},
body: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
total_score: 1000,
total_driven_distance: 123,
total_driven_time: 122
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/game/:game_id/end');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
total_score: 1000,
total_driven_distance: 123,
total_driven_time: 122
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/end',
headers: {'content-type': 'application/json'},
data: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
total_score: 1000,
total_driven_distance: 123,
total_driven_time: 122
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/game/:game_id/end';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1","data":{"false_start":false,"total_score":1000,"total_driven_distance":123,"total_driven_time":122}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"app_version": @"V.1.14.15_A",
@"game_id": @"Race1",
@"user_name": @"PlayerNo1",
@"data": @{ @"false_start": @NO, @"total_score": @1000, @"total_driven_distance": @123, @"total_driven_time": @122 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/game/:game_id/end"]
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/game/:game_id/end" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/game/:game_id/end",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'false_start' => null,
'total_score' => 1000,
'total_driven_distance' => 123,
'total_driven_time' => 122
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/game/:game_id/end', [
'body' => '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/game/:game_id/end');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'false_start' => null,
'total_score' => 1000,
'total_driven_distance' => 123,
'total_driven_time' => 122
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'false_start' => null,
'total_score' => 1000,
'total_driven_distance' => 123,
'total_driven_time' => 122
]
]));
$request->setRequestUrl('{{baseUrl}}/game/:game_id/end');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/game/:game_id/end' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/game/:game_id/end' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/game/:game_id/end", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/game/:game_id/end"
payload = {
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": False,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/game/:game_id/end"
payload <- "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/game/:game_id/end")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/game/:game_id/end') do |req|
req.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"total_score\": 1000,\n \"total_driven_distance\": 123,\n \"total_driven_time\": 122\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/game/:game_id/end";
let payload = json!({
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": json!({
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/game/:game_id/end \
--header 'content-type: application/json' \
--data '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
}
}'
echo '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
}
}' | \
http POST {{baseUrl}}/game/:game_id/end \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1",\n "data": {\n "false_start": false,\n "total_score": 1000,\n "total_driven_distance": 123,\n "total_driven_time": 122\n }\n}' \
--output-document \
- {{baseUrl}}/game/:game_id/end
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": [
"false_start": false,
"total_score": 1000,
"total_driven_distance": 123,
"total_driven_time": 122
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/game/:game_id/end")! 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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Enterevent
{{baseUrl}}/game/:game_id/enter
QUERY PARAMS
game_id
BODY json
{
"app_version": "",
"game_id": "",
"user_id": "",
"user_name": "",
"time": "",
"data": {
"game_mode": "",
"start_time": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"engine_type": "",
"tuning_type": "",
"steering_angle": "",
"softsteering": false,
"driftassist": false,
"car_name": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/game/:game_id/enter");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/game/:game_id/enter" {:content-type :json
:form-params {:app_version "V.1.14.15_A"
:game_id "Race1"
:user_name "PlayerNo1"
:data {:engine_type "V8"
:tuning_type "BASIC SETUP 550 PS"
:steering_angle 70
:softsteering false
:driftassist true
:car_name "Yellow Beast"}}})
require "http/client"
url = "{{baseUrl}}/game/:game_id/enter"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/game/:game_id/enter"),
Content = new StringContent("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/game/:game_id/enter");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/game/:game_id/enter"
payload := strings.NewReader("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/game/:game_id/enter HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 276
{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/game/:game_id/enter")
.setHeader("content-type", "application/json")
.setBody("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/game/:game_id/enter"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/game/:game_id/enter")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/game/:game_id/enter")
.header("content-type", "application/json")
.body("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}")
.asString();
const data = JSON.stringify({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
engine_type: 'V8',
tuning_type: 'BASIC SETUP 550 PS',
steering_angle: 70,
softsteering: false,
driftassist: true,
car_name: 'Yellow Beast'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/game/:game_id/enter');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/enter',
headers: {'content-type': 'application/json'},
data: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
engine_type: 'V8',
tuning_type: 'BASIC SETUP 550 PS',
steering_angle: 70,
softsteering: false,
driftassist: true,
car_name: 'Yellow Beast'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/game/:game_id/enter';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1","data":{"engine_type":"V8","tuning_type":"BASIC SETUP 550 PS","steering_angle":70,"softsteering":false,"driftassist":true,"car_name":"Yellow Beast"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/game/:game_id/enter',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1",\n "data": {\n "engine_type": "V8",\n "tuning_type": "BASIC SETUP 550 PS",\n "steering_angle": 70,\n "softsteering": false,\n "driftassist": true,\n "car_name": "Yellow Beast"\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/game/:game_id/enter")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/game/:game_id/enter',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
engine_type: 'V8',
tuning_type: 'BASIC SETUP 550 PS',
steering_angle: 70,
softsteering: false,
driftassist: true,
car_name: 'Yellow Beast'
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/enter',
headers: {'content-type': 'application/json'},
body: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
engine_type: 'V8',
tuning_type: 'BASIC SETUP 550 PS',
steering_angle: 70,
softsteering: false,
driftassist: true,
car_name: 'Yellow Beast'
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/game/:game_id/enter');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
engine_type: 'V8',
tuning_type: 'BASIC SETUP 550 PS',
steering_angle: 70,
softsteering: false,
driftassist: true,
car_name: 'Yellow Beast'
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/enter',
headers: {'content-type': 'application/json'},
data: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
engine_type: 'V8',
tuning_type: 'BASIC SETUP 550 PS',
steering_angle: 70,
softsteering: false,
driftassist: true,
car_name: 'Yellow Beast'
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/game/:game_id/enter';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1","data":{"engine_type":"V8","tuning_type":"BASIC SETUP 550 PS","steering_angle":70,"softsteering":false,"driftassist":true,"car_name":"Yellow Beast"}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"app_version": @"V.1.14.15_A",
@"game_id": @"Race1",
@"user_name": @"PlayerNo1",
@"data": @{ @"engine_type": @"V8", @"tuning_type": @"BASIC SETUP 550 PS", @"steering_angle": @70, @"softsteering": @NO, @"driftassist": @YES, @"car_name": @"Yellow Beast" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/game/:game_id/enter"]
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/game/:game_id/enter" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/game/:game_id/enter",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'engine_type' => 'V8',
'tuning_type' => 'BASIC SETUP 550 PS',
'steering_angle' => 70,
'softsteering' => null,
'driftassist' => null,
'car_name' => 'Yellow Beast'
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/game/:game_id/enter', [
'body' => '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/game/:game_id/enter');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'engine_type' => 'V8',
'tuning_type' => 'BASIC SETUP 550 PS',
'steering_angle' => 70,
'softsteering' => null,
'driftassist' => null,
'car_name' => 'Yellow Beast'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'engine_type' => 'V8',
'tuning_type' => 'BASIC SETUP 550 PS',
'steering_angle' => 70,
'softsteering' => null,
'driftassist' => null,
'car_name' => 'Yellow Beast'
]
]));
$request->setRequestUrl('{{baseUrl}}/game/:game_id/enter');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/game/:game_id/enter' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/game/:game_id/enter' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/game/:game_id/enter", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/game/:game_id/enter"
payload = {
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": False,
"driftassist": True,
"car_name": "Yellow Beast"
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/game/:game_id/enter"
payload <- "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/game/:game_id/enter")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/game/:game_id/enter') do |req|
req.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"engine_type\": \"V8\",\n \"tuning_type\": \"BASIC SETUP 550 PS\",\n \"steering_angle\": 70,\n \"softsteering\": false,\n \"driftassist\": true,\n \"car_name\": \"Yellow Beast\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/game/:game_id/enter";
let payload = json!({
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": json!({
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/game/:game_id/enter \
--header 'content-type: application/json' \
--data '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
}
}'
echo '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
}
}' | \
http POST {{baseUrl}}/game/:game_id/enter \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1",\n "data": {\n "engine_type": "V8",\n "tuning_type": "BASIC SETUP 550 PS",\n "steering_angle": 70,\n "softsteering": false,\n "driftassist": true,\n "car_name": "Yellow Beast"\n }\n}' \
--output-document \
- {{baseUrl}}/game/:game_id/enter
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": [
"engine_type": "V8",
"tuning_type": "BASIC SETUP 550 PS",
"steering_angle": 70,
"softsteering": false,
"driftassist": true,
"car_name": "Yellow Beast"
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/game/:game_id/enter")! 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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Startevent
{{baseUrl}}/game/:game_id/start
QUERY PARAMS
game_id
BODY json
{
"app_version": "",
"game_id": "",
"user_id": "",
"user_name": "",
"time": "",
"data": {
"signal_time": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/game/:game_id/start");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/game/:game_id/start" {:content-type :json
:form-params {:app_version "V.1.14.15_A"
:game_id "Race1"
:user_name "PlayerNo1"}})
require "http/client"
url = "{{baseUrl}}/game/:game_id/start"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/game/:game_id/start"),
Content = new StringContent("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/game/:game_id/start");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/game/:game_id/start"
payload := strings.NewReader("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/game/:game_id/start HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 84
{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/game/:game_id/start")
.setHeader("content-type", "application/json")
.setBody("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/game/:game_id/start"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/game/:game_id/start")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/game/:game_id/start")
.header("content-type", "application/json")
.body("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}")
.asString();
const data = JSON.stringify({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/game/:game_id/start');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/start',
headers: {'content-type': 'application/json'},
data: {app_version: 'V.1.14.15_A', game_id: 'Race1', user_name: 'PlayerNo1'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/game/:game_id/start';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/game/:game_id/start',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/game/:game_id/start")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/game/:game_id/start',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({app_version: 'V.1.14.15_A', game_id: 'Race1', user_name: 'PlayerNo1'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/start',
headers: {'content-type': 'application/json'},
body: {app_version: 'V.1.14.15_A', game_id: 'Race1', user_name: 'PlayerNo1'},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/game/:game_id/start');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/start',
headers: {'content-type': 'application/json'},
data: {app_version: 'V.1.14.15_A', game_id: 'Race1', user_name: 'PlayerNo1'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/game/:game_id/start';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"app_version": @"V.1.14.15_A",
@"game_id": @"Race1",
@"user_name": @"PlayerNo1" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/game/:game_id/start"]
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/game/:game_id/start" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/game/:game_id/start",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1'
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/game/:game_id/start', [
'body' => '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/game/:game_id/start');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1'
]));
$request->setRequestUrl('{{baseUrl}}/game/:game_id/start');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/game/:game_id/start' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/game/:game_id/start' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/game/:game_id/start", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/game/:game_id/start"
payload = {
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/game/:game_id/start"
payload <- "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/game/:game_id/start")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/game/:game_id/start') do |req|
req.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/game/:game_id/start";
let payload = json!({
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/game/:game_id/start \
--header 'content-type: application/json' \
--data '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
}'
echo '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
}' | \
http POST {{baseUrl}}/game/:game_id/start \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1"\n}' \
--output-document \
- {{baseUrl}}/game/:game_id/start
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/game/:game_id/start")! 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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Targetevent
{{baseUrl}}/game/:game_id/target
QUERY PARAMS
game_id
BODY json
{
"app_version": "",
"game_id": "",
"user_id": "",
"user_name": "",
"time": "",
"data": {
"crossing_time": "",
"target_code": 0,
"false_start": false,
"driven_distance": "",
"driven_time": "",
"score": 0,
"orientations": [
{
"speed": "",
"angle": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/game/:game_id/target");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/game/:game_id/target" {:content-type :json
:form-params {:app_version "V.1.14.15_A"
:game_id "Race1"
:user_name "PlayerNo1"
:data {:false_start false
:driven_distance 23
:driven_time 42
:score 100}}})
require "http/client"
url = "{{baseUrl}}/game/:game_id/target"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/game/:game_id/target"),
Content = new StringContent("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/game/:game_id/target");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/game/:game_id/target"
payload := strings.NewReader("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/game/:game_id/target HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 194
{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/game/:game_id/target")
.setHeader("content-type", "application/json")
.setBody("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/game/:game_id/target"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/game/:game_id/target")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/game/:game_id/target")
.header("content-type", "application/json")
.body("{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}")
.asString();
const data = JSON.stringify({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
driven_distance: 23,
driven_time: 42,
score: 100
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/game/:game_id/target');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/target',
headers: {'content-type': 'application/json'},
data: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {false_start: false, driven_distance: 23, driven_time: 42, score: 100}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/game/:game_id/target';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1","data":{"false_start":false,"driven_distance":23,"driven_time":42,"score":100}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/game/:game_id/target',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1",\n "data": {\n "false_start": false,\n "driven_distance": 23,\n "driven_time": 42,\n "score": 100\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/game/:game_id/target")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/game/:game_id/target',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {false_start: false, driven_distance: 23, driven_time: 42, score: 100}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/target',
headers: {'content-type': 'application/json'},
body: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {false_start: false, driven_distance: 23, driven_time: 42, score: 100}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/game/:game_id/target');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {
false_start: false,
driven_distance: 23,
driven_time: 42,
score: 100
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/game/:game_id/target',
headers: {'content-type': 'application/json'},
data: {
app_version: 'V.1.14.15_A',
game_id: 'Race1',
user_name: 'PlayerNo1',
data: {false_start: false, driven_distance: 23, driven_time: 42, score: 100}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/game/:game_id/target';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"app_version":"V.1.14.15_A","game_id":"Race1","user_name":"PlayerNo1","data":{"false_start":false,"driven_distance":23,"driven_time":42,"score":100}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"app_version": @"V.1.14.15_A",
@"game_id": @"Race1",
@"user_name": @"PlayerNo1",
@"data": @{ @"false_start": @NO, @"driven_distance": @23, @"driven_time": @42, @"score": @100 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/game/:game_id/target"]
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/game/:game_id/target" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/game/:game_id/target",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'false_start' => null,
'driven_distance' => 23,
'driven_time' => 42,
'score' => 100
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/game/:game_id/target', [
'body' => '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/game/:game_id/target');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'false_start' => null,
'driven_distance' => 23,
'driven_time' => 42,
'score' => 100
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'app_version' => 'V.1.14.15_A',
'game_id' => 'Race1',
'user_name' => 'PlayerNo1',
'data' => [
'false_start' => null,
'driven_distance' => 23,
'driven_time' => 42,
'score' => 100
]
]));
$request->setRequestUrl('{{baseUrl}}/game/:game_id/target');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/game/:game_id/target' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/game/:game_id/target' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/game/:game_id/target", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/game/:game_id/target"
payload = {
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": False,
"driven_distance": 23,
"driven_time": 42,
"score": 100
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/game/:game_id/target"
payload <- "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/game/:game_id/target")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/game/:game_id/target') do |req|
req.body = "{\n \"app_version\": \"V.1.14.15_A\",\n \"game_id\": \"Race1\",\n \"user_name\": \"PlayerNo1\",\n \"data\": {\n \"false_start\": false,\n \"driven_distance\": 23,\n \"driven_time\": 42,\n \"score\": 100\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/game/:game_id/target";
let payload = json!({
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": json!({
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/game/:game_id/target \
--header 'content-type: application/json' \
--data '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
}
}'
echo '{
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": {
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
}
}' | \
http POST {{baseUrl}}/game/:game_id/target \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "app_version": "V.1.14.15_A",\n "game_id": "Race1",\n "user_name": "PlayerNo1",\n "data": {\n "false_start": false,\n "driven_distance": 23,\n "driven_time": 42,\n "score": 100\n }\n}' \
--output-document \
- {{baseUrl}}/game/:game_id/target
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"app_version": "V.1.14.15_A",
"game_id": "Race1",
"user_name": "PlayerNo1",
"data": [
"false_start": false,
"driven_distance": 23,
"driven_time": 42,
"score": 100
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/game/:game_id/target")! 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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Ping
{{baseUrl}}/game/:game_id/ping
QUERY PARAMS
game_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/game/:game_id/ping");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/game/:game_id/ping")
require "http/client"
url = "{{baseUrl}}/game/:game_id/ping"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/game/:game_id/ping"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/game/:game_id/ping");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/game/:game_id/ping"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/game/:game_id/ping HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/game/:game_id/ping")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/game/:game_id/ping"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/game/:game_id/ping")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/game/:game_id/ping")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/game/:game_id/ping');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/game/:game_id/ping'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/game/:game_id/ping';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/game/:game_id/ping',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/game/:game_id/ping")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/game/:game_id/ping',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/game/:game_id/ping'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/game/:game_id/ping');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/game/:game_id/ping'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/game/:game_id/ping';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/game/:game_id/ping"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/game/:game_id/ping" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/game/:game_id/ping",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/game/:game_id/ping');
echo $response->getBody();
setUrl('{{baseUrl}}/game/:game_id/ping');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/game/:game_id/ping');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/game/:game_id/ping' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/game/:game_id/ping' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/game/:game_id/ping")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/game/:game_id/ping"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/game/:game_id/ping"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/game/:game_id/ping")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/game/:game_id/ping') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/game/:game_id/ping";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/game/:game_id/ping
http GET {{baseUrl}}/game/:game_id/ping
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/game/:game_id/ping
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/game/:game_id/ping")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"status": true
}
POST
Create Game
{{baseUrl}}/manage_game/create
BODY json
{
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/manage_game/create");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/manage_game/create" {:content-type :json
:form-params {:game_id ""
:start_time ""
:start_delay ""
:track_id ""
:time_limit ""
:lap_count 0
:track_condition ""
:track_bundle ""
:wheels ""
:setup_mode ""
:joker_lap_code 0
:joker_lap_precondition_code 0}})
require "http/client"
url = "{{baseUrl}}/manage_game/create"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/manage_game/create"),
Content = new StringContent("{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/manage_game/create");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/manage_game/create"
payload := strings.NewReader("{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/manage_game/create HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 258
{
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/manage_game/create")
.setHeader("content-type", "application/json")
.setBody("{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/manage_game/create"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/manage_game/create")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/manage_game/create")
.header("content-type", "application/json")
.body("{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}")
.asString();
const data = JSON.stringify({
game_id: '',
start_time: '',
start_delay: '',
track_id: '',
time_limit: '',
lap_count: 0,
track_condition: '',
track_bundle: '',
wheels: '',
setup_mode: '',
joker_lap_code: 0,
joker_lap_precondition_code: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/manage_game/create');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/manage_game/create',
headers: {'content-type': 'application/json'},
data: {
game_id: '',
start_time: '',
start_delay: '',
track_id: '',
time_limit: '',
lap_count: 0,
track_condition: '',
track_bundle: '',
wheels: '',
setup_mode: '',
joker_lap_code: 0,
joker_lap_precondition_code: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/manage_game/create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"game_id":"","start_time":"","start_delay":"","track_id":"","time_limit":"","lap_count":0,"track_condition":"","track_bundle":"","wheels":"","setup_mode":"","joker_lap_code":0,"joker_lap_precondition_code":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/manage_game/create',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "game_id": "",\n "start_time": "",\n "start_delay": "",\n "track_id": "",\n "time_limit": "",\n "lap_count": 0,\n "track_condition": "",\n "track_bundle": "",\n "wheels": "",\n "setup_mode": "",\n "joker_lap_code": 0,\n "joker_lap_precondition_code": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/manage_game/create")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/manage_game/create',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
game_id: '',
start_time: '',
start_delay: '',
track_id: '',
time_limit: '',
lap_count: 0,
track_condition: '',
track_bundle: '',
wheels: '',
setup_mode: '',
joker_lap_code: 0,
joker_lap_precondition_code: 0
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/manage_game/create',
headers: {'content-type': 'application/json'},
body: {
game_id: '',
start_time: '',
start_delay: '',
track_id: '',
time_limit: '',
lap_count: 0,
track_condition: '',
track_bundle: '',
wheels: '',
setup_mode: '',
joker_lap_code: 0,
joker_lap_precondition_code: 0
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/manage_game/create');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
game_id: '',
start_time: '',
start_delay: '',
track_id: '',
time_limit: '',
lap_count: 0,
track_condition: '',
track_bundle: '',
wheels: '',
setup_mode: '',
joker_lap_code: 0,
joker_lap_precondition_code: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/manage_game/create',
headers: {'content-type': 'application/json'},
data: {
game_id: '',
start_time: '',
start_delay: '',
track_id: '',
time_limit: '',
lap_count: 0,
track_condition: '',
track_bundle: '',
wheels: '',
setup_mode: '',
joker_lap_code: 0,
joker_lap_precondition_code: 0
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/manage_game/create';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"game_id":"","start_time":"","start_delay":"","track_id":"","time_limit":"","lap_count":0,"track_condition":"","track_bundle":"","wheels":"","setup_mode":"","joker_lap_code":0,"joker_lap_precondition_code":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"game_id": @"",
@"start_time": @"",
@"start_delay": @"",
@"track_id": @"",
@"time_limit": @"",
@"lap_count": @0,
@"track_condition": @"",
@"track_bundle": @"",
@"wheels": @"",
@"setup_mode": @"",
@"joker_lap_code": @0,
@"joker_lap_precondition_code": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/manage_game/create"]
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/manage_game/create" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/manage_game/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'game_id' => '',
'start_time' => '',
'start_delay' => '',
'track_id' => '',
'time_limit' => '',
'lap_count' => 0,
'track_condition' => '',
'track_bundle' => '',
'wheels' => '',
'setup_mode' => '',
'joker_lap_code' => 0,
'joker_lap_precondition_code' => 0
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/manage_game/create', [
'body' => '{
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/manage_game/create');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'game_id' => '',
'start_time' => '',
'start_delay' => '',
'track_id' => '',
'time_limit' => '',
'lap_count' => 0,
'track_condition' => '',
'track_bundle' => '',
'wheels' => '',
'setup_mode' => '',
'joker_lap_code' => 0,
'joker_lap_precondition_code' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'game_id' => '',
'start_time' => '',
'start_delay' => '',
'track_id' => '',
'time_limit' => '',
'lap_count' => 0,
'track_condition' => '',
'track_bundle' => '',
'wheels' => '',
'setup_mode' => '',
'joker_lap_code' => 0,
'joker_lap_precondition_code' => 0
]));
$request->setRequestUrl('{{baseUrl}}/manage_game/create');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/manage_game/create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/manage_game/create' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/manage_game/create", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/manage_game/create"
payload = {
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/manage_game/create"
payload <- "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/manage_game/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/manage_game/create') do |req|
req.body = "{\n \"game_id\": \"\",\n \"start_time\": \"\",\n \"start_delay\": \"\",\n \"track_id\": \"\",\n \"time_limit\": \"\",\n \"lap_count\": 0,\n \"track_condition\": \"\",\n \"track_bundle\": \"\",\n \"wheels\": \"\",\n \"setup_mode\": \"\",\n \"joker_lap_code\": 0,\n \"joker_lap_precondition_code\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/manage_game/create";
let payload = json!({
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/manage_game/create \
--header 'content-type: application/json' \
--data '{
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}'
echo '{
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
}' | \
http POST {{baseUrl}}/manage_game/create \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "game_id": "",\n "start_time": "",\n "start_delay": "",\n "track_id": "",\n "time_limit": "",\n "lap_count": 0,\n "track_condition": "",\n "track_bundle": "",\n "wheels": "",\n "setup_mode": "",\n "joker_lap_code": 0,\n "joker_lap_precondition_code": 0\n}' \
--output-document \
- {{baseUrl}}/manage_game/create
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"game_id": "",
"start_time": "",
"start_delay": "",
"track_id": "",
"time_limit": "",
"lap_count": 0,
"track_condition": "",
"track_bundle": "",
"wheels": "",
"setup_mode": "",
"joker_lap_code": 0,
"joker_lap_precondition_code": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/manage_game/create")! 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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Delete Game
{{baseUrl}}/manage_game/delete/:game_id
QUERY PARAMS
game_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/manage_game/delete/:game_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/manage_game/delete/:game_id")
require "http/client"
url = "{{baseUrl}}/manage_game/delete/:game_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/manage_game/delete/:game_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/manage_game/delete/:game_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/manage_game/delete/:game_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/manage_game/delete/:game_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/manage_game/delete/:game_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/manage_game/delete/:game_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/manage_game/delete/:game_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/manage_game/delete/:game_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/manage_game/delete/:game_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/delete/:game_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/manage_game/delete/:game_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/manage_game/delete/:game_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/manage_game/delete/:game_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/manage_game/delete/:game_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/delete/:game_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/manage_game/delete/:game_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/delete/:game_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/manage_game/delete/:game_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/manage_game/delete/:game_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/manage_game/delete/:game_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/manage_game/delete/:game_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/manage_game/delete/:game_id');
echo $response->getBody();
setUrl('{{baseUrl}}/manage_game/delete/:game_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/manage_game/delete/:game_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/manage_game/delete/:game_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/manage_game/delete/:game_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/manage_game/delete/:game_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/manage_game/delete/:game_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/manage_game/delete/:game_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/manage_game/delete/:game_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/manage_game/delete/:game_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/manage_game/delete/:game_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/manage_game/delete/:game_id
http GET {{baseUrl}}/manage_game/delete/:game_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/manage_game/delete/:game_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/manage_game/delete/:game_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Find Game
{{baseUrl}}/manage_game/find/
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/manage_game/find/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/manage_game/find/" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/manage_game/find/"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/manage_game/find/"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/manage_game/find/");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/manage_game/find/"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/manage_game/find/ HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/manage_game/find/")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/manage_game/find/"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/manage_game/find/")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/manage_game/find/")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/manage_game/find/');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/manage_game/find/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/manage_game/find/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/manage_game/find/',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/manage_game/find/")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/manage_game/find/',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/manage_game/find/',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/manage_game/find/');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/manage_game/find/',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/manage_game/find/';
const options = {method: 'POST', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/manage_game/find/"]
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/manage_game/find/" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/manage_game/find/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/manage_game/find/', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/manage_game/find/');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/manage_game/find/');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/manage_game/find/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/manage_game/find/' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/manage_game/find/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/manage_game/find/"
payload = {}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/manage_game/find/"
payload <- "{}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/manage_game/find/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/manage_game/find/') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/manage_game/find/";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/manage_game/find/ \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http POST {{baseUrl}}/manage_game/find/ \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/manage_game/find/
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/manage_game/find/")! 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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Get Events
{{baseUrl}}/game/:game_id/events
QUERY PARAMS
game_id
BODY json
{}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/game/:game_id/events");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/game/:game_id/events" {:content-type :json})
require "http/client"
url = "{{baseUrl}}/game/:game_id/events"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/game/:game_id/events"),
Content = new StringContent("{}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/game/:game_id/events");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/game/:game_id/events"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/game/:game_id/events HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2
{}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/game/:game_id/events")
.setHeader("content-type", "application/json")
.setBody("{}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/game/:game_id/events"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{}");
Request request = new Request.Builder()
.url("{{baseUrl}}/game/:game_id/events")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/game/:game_id/events")
.header("content-type", "application/json")
.body("{}")
.asString();
const data = JSON.stringify({});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/game/:game_id/events');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/game/:game_id/events',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/game/:game_id/events';
const options = {method: 'PUT', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/game/:game_id/events',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{}")
val request = Request.Builder()
.url("{{baseUrl}}/game/:game_id/events")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/game/:game_id/events',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/game/:game_id/events',
headers: {'content-type': 'application/json'},
body: {},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/game/:game_id/events');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/game/:game_id/events',
headers: {'content-type': 'application/json'},
data: {}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/game/:game_id/events';
const options = {method: 'PUT', headers: {'content-type': 'application/json'}, body: '{}'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/game/:game_id/events"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/game/:game_id/events" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/game/:game_id/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/game/:game_id/events', [
'body' => '{}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/game/:game_id/events');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
]));
$request->setRequestUrl('{{baseUrl}}/game/:game_id/events');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/game/:game_id/events' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/game/:game_id/events' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/game/:game_id/events", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/game/:game_id/events"
payload = {}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/game/:game_id/events"
payload <- "{}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/game/:game_id/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/game/:game_id/events') do |req|
req.body = "{}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/game/:game_id/events";
let payload = json!({});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/game/:game_id/events \
--header 'content-type: application/json' \
--data '{}'
echo '{}' | \
http PUT {{baseUrl}}/game/:game_id/events \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{}' \
--output-document \
- {{baseUrl}}/game/:game_id/events
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/game/:game_id/events")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
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 as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Game
{{baseUrl}}/manage_game/get/:game_id/
QUERY PARAMS
game_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/manage_game/get/:game_id/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/manage_game/get/:game_id/")
require "http/client"
url = "{{baseUrl}}/manage_game/get/:game_id/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/manage_game/get/:game_id/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/manage_game/get/:game_id/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/manage_game/get/:game_id/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/manage_game/get/:game_id/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/manage_game/get/:game_id/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/manage_game/get/:game_id/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/manage_game/get/:game_id/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/manage_game/get/:game_id/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/manage_game/get/:game_id/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/get/:game_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/manage_game/get/:game_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/manage_game/get/:game_id/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/manage_game/get/:game_id/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/manage_game/get/:game_id/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/get/:game_id/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/manage_game/get/:game_id/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/get/:game_id/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/manage_game/get/:game_id/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/manage_game/get/:game_id/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/manage_game/get/:game_id/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/manage_game/get/:game_id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/manage_game/get/:game_id/');
echo $response->getBody();
setUrl('{{baseUrl}}/manage_game/get/:game_id/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/manage_game/get/:game_id/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/manage_game/get/:game_id/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/manage_game/get/:game_id/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/manage_game/get/:game_id/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/manage_game/get/:game_id/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/manage_game/get/:game_id/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/manage_game/get/:game_id/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/manage_game/get/:game_id/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/manage_game/get/:game_id/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/manage_game/get/:game_id/
http GET {{baseUrl}}/manage_game/get/:game_id/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/manage_game/get/:game_id/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/manage_game/get/:game_id/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Scoreboard
{{baseUrl}}/game/:game_id/playerstatus
QUERY PARAMS
game_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/game/:game_id/playerstatus");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/game/:game_id/playerstatus")
require "http/client"
url = "{{baseUrl}}/game/:game_id/playerstatus"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/game/:game_id/playerstatus"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/game/:game_id/playerstatus");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/game/:game_id/playerstatus"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/game/:game_id/playerstatus HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/game/:game_id/playerstatus")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/game/:game_id/playerstatus"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/game/:game_id/playerstatus")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/game/:game_id/playerstatus")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/game/:game_id/playerstatus');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/game/:game_id/playerstatus'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/game/:game_id/playerstatus';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/game/:game_id/playerstatus',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/game/:game_id/playerstatus")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/game/:game_id/playerstatus',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/game/:game_id/playerstatus'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/game/:game_id/playerstatus');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/game/:game_id/playerstatus'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/game/:game_id/playerstatus';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/game/:game_id/playerstatus"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/game/:game_id/playerstatus" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/game/:game_id/playerstatus",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/game/:game_id/playerstatus');
echo $response->getBody();
setUrl('{{baseUrl}}/game/:game_id/playerstatus');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/game/:game_id/playerstatus');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/game/:game_id/playerstatus' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/game/:game_id/playerstatus' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/game/:game_id/playerstatus")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/game/:game_id/playerstatus"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/game/:game_id/playerstatus"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/game/:game_id/playerstatus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/game/:game_id/playerstatus') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/game/:game_id/playerstatus";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/game/:game_id/playerstatus
http GET {{baseUrl}}/game/:game_id/playerstatus
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/game/:game_id/playerstatus
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/game/:game_id/playerstatus")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Reset Game
{{baseUrl}}/manage_game/reset/:game_id
QUERY PARAMS
game_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/manage_game/reset/:game_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/manage_game/reset/:game_id")
require "http/client"
url = "{{baseUrl}}/manage_game/reset/:game_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/manage_game/reset/:game_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/manage_game/reset/:game_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/manage_game/reset/:game_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/manage_game/reset/:game_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/manage_game/reset/:game_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/manage_game/reset/:game_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/manage_game/reset/:game_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/manage_game/reset/:game_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/manage_game/reset/:game_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/reset/:game_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/manage_game/reset/:game_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/manage_game/reset/:game_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/manage_game/reset/:game_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/manage_game/reset/:game_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/reset/:game_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/manage_game/reset/:game_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/manage_game/reset/:game_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/manage_game/reset/:game_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/manage_game/reset/:game_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/manage_game/reset/:game_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/manage_game/reset/:game_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/manage_game/reset/:game_id');
echo $response->getBody();
setUrl('{{baseUrl}}/manage_game/reset/:game_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/manage_game/reset/:game_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/manage_game/reset/:game_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/manage_game/reset/:game_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/manage_game/reset/:game_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/manage_game/reset/:game_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/manage_game/reset/:game_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/manage_game/reset/:game_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/manage_game/reset/:game_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/manage_game/reset/:game_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/manage_game/reset/:game_id
http GET {{baseUrl}}/manage_game/reset/:game_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/manage_game/reset/:game_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/manage_game/reset/:game_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Reset Player
{{baseUrl}}/manage_game/reset_player/:game_id/:user_name
QUERY PARAMS
game_id
user_name
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name")
require "http/client"
url = "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/manage_game/reset_player/:game_id/:user_name"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/manage_game/reset_player/:game_id/:user_name");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/manage_game/reset_player/:game_id/:user_name HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/manage_game/reset_player/:game_id/:user_name"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/manage_game/reset_player/:game_id/:user_name")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/manage_game/reset_player/:game_id/:user_name")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/manage_game/reset_player/:game_id/:user_name")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/manage_game/reset_player/:game_id/:user_name',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/manage_game/reset_player/:game_id/:user_name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/manage_game/reset_player/:game_id/:user_name",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name');
echo $response->getBody();
setUrl('{{baseUrl}}/manage_game/reset_player/:game_id/:user_name');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/manage_game/reset_player/:game_id/:user_name');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/manage_game/reset_player/:game_id/:user_name' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/manage_game/reset_player/:game_id/:user_name")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/manage_game/reset_player/:game_id/:user_name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/manage_game/reset_player/:game_id/:user_name') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/manage_game/reset_player/:game_id/:user_name
http GET {{baseUrl}}/manage_game/reset_player/:game_id/:user_name
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/manage_game/reset_player/:game_id/:user_name
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/manage_game/reset_player/:game_id/:user_name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Root
{{baseUrl}}/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/")
require "http/client"
url = "{{baseUrl}}/"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
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];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/');
echo $response->getBody();
setUrl('{{baseUrl}}/');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/
http GET {{baseUrl}}/
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()