Fitness API
POST
fitness.users.dataSources.create
{{baseUrl}}/:userId/dataSources
QUERY PARAMS
userId
BODY json
{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources");
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 \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:userId/dataSources" {:content-type :json
:form-params {:application {:detailsUrl ""
:name ""
:packageName ""
:version ""}
:dataQualityStandard []
:dataStreamId ""
:dataStreamName ""
:dataType {:field [{:format ""
:name ""
:optional false}]
:name ""}
:device {:manufacturer ""
:model ""
:type ""
:uid ""
:version ""}
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/:userId/dataSources"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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}}/:userId/dataSources"),
Content = new StringContent("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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}}/:userId/dataSources");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources"
payload := strings.NewReader("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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/:userId/dataSources HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 459
{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:userId/dataSources")
.setHeader("content-type", "application/json")
.setBody("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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 \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:userId/dataSources")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:userId/dataSources")
.header("content-type", "application/json")
.body("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
application: {
detailsUrl: '',
name: '',
packageName: '',
version: ''
},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {
field: [
{
format: '',
name: '',
optional: false
}
],
name: ''
},
device: {
manufacturer: '',
model: '',
type: '',
uid: '',
version: ''
},
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:userId/dataSources');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:userId/dataSources',
headers: {'content-type': 'application/json'},
data: {
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application":{"detailsUrl":"","name":"","packageName":"","version":""},"dataQualityStandard":[],"dataStreamId":"","dataStreamName":"","dataType":{"field":[{"format":"","name":"","optional":false}],"name":""},"device":{"manufacturer":"","model":"","type":"","uid":"","version":""},"name":"","type":""}'
};
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}}/:userId/dataSources',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "application": {\n "detailsUrl": "",\n "name": "",\n "packageName": "",\n "version": ""\n },\n "dataQualityStandard": [],\n "dataStreamId": "",\n "dataStreamName": "",\n "dataType": {\n "field": [\n {\n "format": "",\n "name": "",\n "optional": false\n }\n ],\n "name": ""\n },\n "device": {\n "manufacturer": "",\n "model": "",\n "type": "",\n "uid": "",\n "version": ""\n },\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources")
.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/:userId/dataSources',
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({
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:userId/dataSources',
headers: {'content-type': 'application/json'},
body: {
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
},
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}}/:userId/dataSources');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
application: {
detailsUrl: '',
name: '',
packageName: '',
version: ''
},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {
field: [
{
format: '',
name: '',
optional: false
}
],
name: ''
},
device: {
manufacturer: '',
model: '',
type: '',
uid: '',
version: ''
},
name: '',
type: ''
});
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}}/:userId/dataSources',
headers: {'content-type': 'application/json'},
data: {
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"application":{"detailsUrl":"","name":"","packageName":"","version":""},"dataQualityStandard":[],"dataStreamId":"","dataStreamName":"","dataType":{"field":[{"format":"","name":"","optional":false}],"name":""},"device":{"manufacturer":"","model":"","type":"","uid":"","version":""},"name":"","type":""}'
};
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 = @{ @"application": @{ @"detailsUrl": @"", @"name": @"", @"packageName": @"", @"version": @"" },
@"dataQualityStandard": @[ ],
@"dataStreamId": @"",
@"dataStreamName": @"",
@"dataType": @{ @"field": @[ @{ @"format": @"", @"name": @"", @"optional": @NO } ], @"name": @"" },
@"device": @{ @"manufacturer": @"", @"model": @"", @"type": @"", @"uid": @"", @"version": @"" },
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:userId/dataSources"]
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}}/:userId/dataSources" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources",
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([
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'dataQualityStandard' => [
],
'dataStreamId' => '',
'dataStreamName' => '',
'dataType' => [
'field' => [
[
'format' => '',
'name' => '',
'optional' => null
]
],
'name' => ''
],
'device' => [
'manufacturer' => '',
'model' => '',
'type' => '',
'uid' => '',
'version' => ''
],
'name' => '',
'type' => ''
]),
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}}/:userId/dataSources', [
'body' => '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'dataQualityStandard' => [
],
'dataStreamId' => '',
'dataStreamName' => '',
'dataType' => [
'field' => [
[
'format' => '',
'name' => '',
'optional' => null
]
],
'name' => ''
],
'device' => [
'manufacturer' => '',
'model' => '',
'type' => '',
'uid' => '',
'version' => ''
],
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'dataQualityStandard' => [
],
'dataStreamId' => '',
'dataStreamName' => '',
'dataType' => [
'field' => [
[
'format' => '',
'name' => '',
'optional' => null
]
],
'name' => ''
],
'device' => [
'manufacturer' => '',
'model' => '',
'type' => '',
'uid' => '',
'version' => ''
],
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:userId/dataSources');
$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}}/:userId/dataSources' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:userId/dataSources", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources"
payload = {
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": False
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources"
payload <- "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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}}/:userId/dataSources")
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 \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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/:userId/dataSources') do |req|
req.body = "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataSources";
let payload = json!({
"application": json!({
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
}),
"dataQualityStandard": (),
"dataStreamId": "",
"dataStreamName": "",
"dataType": json!({
"field": (
json!({
"format": "",
"name": "",
"optional": false
})
),
"name": ""
}),
"device": json!({
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
}),
"name": "",
"type": ""
});
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}}/:userId/dataSources \
--header 'content-type: application/json' \
--data '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}'
echo '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}' | \
http POST {{baseUrl}}/:userId/dataSources \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "application": {\n "detailsUrl": "",\n "name": "",\n "packageName": "",\n "version": ""\n },\n "dataQualityStandard": [],\n "dataStreamId": "",\n "dataStreamName": "",\n "dataType": {\n "field": [\n {\n "format": "",\n "name": "",\n "optional": false\n }\n ],\n "name": ""\n },\n "device": {\n "manufacturer": "",\n "model": "",\n "type": "",\n "uid": "",\n "version": ""\n },\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/:userId/dataSources
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"application": [
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
],
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": [
"field": [
[
"format": "",
"name": "",
"optional": false
]
],
"name": ""
],
"device": [
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
],
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources")! 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
fitness.users.dataSources.dataPointChanges.list
{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges
QUERY PARAMS
userId
dataSourceId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges")
require "http/client"
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges"
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}}/:userId/dataSources/:dataSourceId/dataPointChanges"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges"
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/:userId/dataSources/:dataSourceId/dataPointChanges HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges"))
.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}}/:userId/dataSources/:dataSourceId/dataPointChanges")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges")
.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}}/:userId/dataSources/:dataSourceId/dataPointChanges');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges';
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}}/:userId/dataSources/:dataSourceId/dataPointChanges',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/dataSources/:dataSourceId/dataPointChanges',
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}}/:userId/dataSources/:dataSourceId/dataPointChanges'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges');
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}}/:userId/dataSources/:dataSourceId/dataPointChanges'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges';
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}}/:userId/dataSources/:dataSourceId/dataPointChanges"]
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}}/:userId/dataSources/:dataSourceId/dataPointChanges" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges",
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}}/:userId/dataSources/:dataSourceId/dataPointChanges');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:userId/dataSources/:dataSourceId/dataPointChanges")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges")
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/:userId/dataSources/:dataSourceId/dataPointChanges') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges";
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}}/:userId/dataSources/:dataSourceId/dataPointChanges
http GET {{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources/:dataSourceId/dataPointChanges")! 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()
DELETE
fitness.users.dataSources.datasets.delete
{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
QUERY PARAMS
userId
dataSourceId
datasetId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
require "http/client"
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"))
.method("DELETE", 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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.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('DELETE', '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId';
const options = {method: 'DELETE'};
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId',
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: 'DELETE',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId';
const options = {method: 'DELETE'};
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
http DELETE {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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
fitness.users.dataSources.datasets.get
{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
QUERY PARAMS
userId
dataSourceId
datasetId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
require "http/client"
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
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/:userId/dataSources/:dataSourceId/datasets/:datasetId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"))
.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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId';
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId',
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId';
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"]
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId",
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
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/:userId/dataSources/:dataSourceId/datasets/:datasetId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId";
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
http GET {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")! 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()
PATCH
fitness.users.dataSources.datasets.patch
{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
QUERY PARAMS
userId
dataSourceId
datasetId
BODY json
{
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": {
"fpVal": ""
}
}
],
"stringVal": ""
}
]
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId");
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 \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId" {:content-type :json
:form-params {:dataSourceId ""
:maxEndTimeNs ""
:minStartTimeNs ""
:nextPageToken ""
:point [{:computationTimeMillis ""
:dataTypeName ""
:endTimeNanos ""
:modifiedTimeMillis ""
:originDataSourceId ""
:rawTimestampNanos ""
:startTimeNanos ""
:value [{:fpVal ""
:intVal 0
:mapVal [{:key ""
:value {:fpVal ""}}]
:stringVal ""}]}]}})
require "http/client"
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"),
Content = new StringContent("{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
payload := strings.NewReader("{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", 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))
}
PATCH /baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 607
{
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": {
"fpVal": ""
}
}
],
"stringVal": ""
}
]
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.setHeader("content-type", "application/json")
.setBody("{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\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 \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.header("content-type", "application/json")
.body("{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}")
.asString();
const data = JSON.stringify({
dataSourceId: '',
maxEndTimeNs: '',
minStartTimeNs: '',
nextPageToken: '',
point: [
{
computationTimeMillis: '',
dataTypeName: '',
endTimeNanos: '',
modifiedTimeMillis: '',
originDataSourceId: '',
rawTimestampNanos: '',
startTimeNanos: '',
value: [
{
fpVal: '',
intVal: 0,
mapVal: [
{
key: '',
value: {
fpVal: ''
}
}
],
stringVal: ''
}
]
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId',
headers: {'content-type': 'application/json'},
data: {
dataSourceId: '',
maxEndTimeNs: '',
minStartTimeNs: '',
nextPageToken: '',
point: [
{
computationTimeMillis: '',
dataTypeName: '',
endTimeNanos: '',
modifiedTimeMillis: '',
originDataSourceId: '',
rawTimestampNanos: '',
startTimeNanos: '',
value: [{fpVal: '', intVal: 0, mapVal: [{key: '', value: {fpVal: ''}}], stringVal: ''}]
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"dataSourceId":"","maxEndTimeNs":"","minStartTimeNs":"","nextPageToken":"","point":[{"computationTimeMillis":"","dataTypeName":"","endTimeNanos":"","modifiedTimeMillis":"","originDataSourceId":"","rawTimestampNanos":"","startTimeNanos":"","value":[{"fpVal":"","intVal":0,"mapVal":[{"key":"","value":{"fpVal":""}}],"stringVal":""}]}]}'
};
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "dataSourceId": "",\n "maxEndTimeNs": "",\n "minStartTimeNs": "",\n "nextPageToken": "",\n "point": [\n {\n "computationTimeMillis": "",\n "dataTypeName": "",\n "endTimeNanos": "",\n "modifiedTimeMillis": "",\n "originDataSourceId": "",\n "rawTimestampNanos": "",\n "startTimeNanos": "",\n "value": [\n {\n "fpVal": "",\n "intVal": 0,\n "mapVal": [\n {\n "key": "",\n "value": {\n "fpVal": ""\n }\n }\n ],\n "stringVal": ""\n }\n ]\n }\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 \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId',
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({
dataSourceId: '',
maxEndTimeNs: '',
minStartTimeNs: '',
nextPageToken: '',
point: [
{
computationTimeMillis: '',
dataTypeName: '',
endTimeNanos: '',
modifiedTimeMillis: '',
originDataSourceId: '',
rawTimestampNanos: '',
startTimeNanos: '',
value: [{fpVal: '', intVal: 0, mapVal: [{key: '', value: {fpVal: ''}}], stringVal: ''}]
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId',
headers: {'content-type': 'application/json'},
body: {
dataSourceId: '',
maxEndTimeNs: '',
minStartTimeNs: '',
nextPageToken: '',
point: [
{
computationTimeMillis: '',
dataTypeName: '',
endTimeNanos: '',
modifiedTimeMillis: '',
originDataSourceId: '',
rawTimestampNanos: '',
startTimeNanos: '',
value: [{fpVal: '', intVal: 0, mapVal: [{key: '', value: {fpVal: ''}}], stringVal: ''}]
}
]
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
dataSourceId: '',
maxEndTimeNs: '',
minStartTimeNs: '',
nextPageToken: '',
point: [
{
computationTimeMillis: '',
dataTypeName: '',
endTimeNanos: '',
modifiedTimeMillis: '',
originDataSourceId: '',
rawTimestampNanos: '',
startTimeNanos: '',
value: [
{
fpVal: '',
intVal: 0,
mapVal: [
{
key: '',
value: {
fpVal: ''
}
}
],
stringVal: ''
}
]
}
]
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId',
headers: {'content-type': 'application/json'},
data: {
dataSourceId: '',
maxEndTimeNs: '',
minStartTimeNs: '',
nextPageToken: '',
point: [
{
computationTimeMillis: '',
dataTypeName: '',
endTimeNanos: '',
modifiedTimeMillis: '',
originDataSourceId: '',
rawTimestampNanos: '',
startTimeNanos: '',
value: [{fpVal: '', intVal: 0, mapVal: [{key: '', value: {fpVal: ''}}], stringVal: ''}]
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"dataSourceId":"","maxEndTimeNs":"","minStartTimeNs":"","nextPageToken":"","point":[{"computationTimeMillis":"","dataTypeName":"","endTimeNanos":"","modifiedTimeMillis":"","originDataSourceId":"","rawTimestampNanos":"","startTimeNanos":"","value":[{"fpVal":"","intVal":0,"mapVal":[{"key":"","value":{"fpVal":""}}],"stringVal":""}]}]}'
};
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 = @{ @"dataSourceId": @"",
@"maxEndTimeNs": @"",
@"minStartTimeNs": @"",
@"nextPageToken": @"",
@"point": @[ @{ @"computationTimeMillis": @"", @"dataTypeName": @"", @"endTimeNanos": @"", @"modifiedTimeMillis": @"", @"originDataSourceId": @"", @"rawTimestampNanos": @"", @"startTimeNanos": @"", @"value": @[ @{ @"fpVal": @"", @"intVal": @0, @"mapVal": @[ @{ @"key": @"", @"value": @{ @"fpVal": @"" } } ], @"stringVal": @"" } ] } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'dataSourceId' => '',
'maxEndTimeNs' => '',
'minStartTimeNs' => '',
'nextPageToken' => '',
'point' => [
[
'computationTimeMillis' => '',
'dataTypeName' => '',
'endTimeNanos' => '',
'modifiedTimeMillis' => '',
'originDataSourceId' => '',
'rawTimestampNanos' => '',
'startTimeNanos' => '',
'value' => [
[
'fpVal' => '',
'intVal' => 0,
'mapVal' => [
[
'key' => '',
'value' => [
'fpVal' => ''
]
]
],
'stringVal' => ''
]
]
]
]
]),
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('PATCH', '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId', [
'body' => '{
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": {
"fpVal": ""
}
}
],
"stringVal": ""
}
]
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'dataSourceId' => '',
'maxEndTimeNs' => '',
'minStartTimeNs' => '',
'nextPageToken' => '',
'point' => [
[
'computationTimeMillis' => '',
'dataTypeName' => '',
'endTimeNanos' => '',
'modifiedTimeMillis' => '',
'originDataSourceId' => '',
'rawTimestampNanos' => '',
'startTimeNanos' => '',
'value' => [
[
'fpVal' => '',
'intVal' => 0,
'mapVal' => [
[
'key' => '',
'value' => [
'fpVal' => ''
]
]
],
'stringVal' => ''
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'dataSourceId' => '',
'maxEndTimeNs' => '',
'minStartTimeNs' => '',
'nextPageToken' => '',
'point' => [
[
'computationTimeMillis' => '',
'dataTypeName' => '',
'endTimeNanos' => '',
'modifiedTimeMillis' => '',
'originDataSourceId' => '',
'rawTimestampNanos' => '',
'startTimeNanos' => '',
'value' => [
[
'fpVal' => '',
'intVal' => 0,
'mapVal' => [
[
'key' => '',
'value' => [
'fpVal' => ''
]
]
],
'stringVal' => ''
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId');
$request->setRequestMethod('PATCH');
$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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": {
"fpVal": ""
}
}
],
"stringVal": ""
}
]
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": {
"fpVal": ""
}
}
],
"stringVal": ""
}
]
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
payload = {
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": { "fpVal": "" }
}
],
"stringVal": ""
}
]
}
]
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId"
payload <- "{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\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.patch('/baseUrl/:userId/dataSources/:dataSourceId/datasets/:datasetId') do |req|
req.body = "{\n \"dataSourceId\": \"\",\n \"maxEndTimeNs\": \"\",\n \"minStartTimeNs\": \"\",\n \"nextPageToken\": \"\",\n \"point\": [\n {\n \"computationTimeMillis\": \"\",\n \"dataTypeName\": \"\",\n \"endTimeNanos\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"originDataSourceId\": \"\",\n \"rawTimestampNanos\": \"\",\n \"startTimeNanos\": \"\",\n \"value\": [\n {\n \"fpVal\": \"\",\n \"intVal\": 0,\n \"mapVal\": [\n {\n \"key\": \"\",\n \"value\": {\n \"fpVal\": \"\"\n }\n }\n ],\n \"stringVal\": \"\"\n }\n ]\n }\n ]\n}"
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}}/:userId/dataSources/:dataSourceId/datasets/:datasetId";
let payload = json!({
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": (
json!({
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": (
json!({
"fpVal": "",
"intVal": 0,
"mapVal": (
json!({
"key": "",
"value": json!({"fpVal": ""})
})
),
"stringVal": ""
})
)
})
)
});
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("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId \
--header 'content-type: application/json' \
--data '{
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": {
"fpVal": ""
}
}
],
"stringVal": ""
}
]
}
]
}'
echo '{
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
{
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
{
"fpVal": "",
"intVal": 0,
"mapVal": [
{
"key": "",
"value": {
"fpVal": ""
}
}
],
"stringVal": ""
}
]
}
]
}' | \
http PATCH {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "dataSourceId": "",\n "maxEndTimeNs": "",\n "minStartTimeNs": "",\n "nextPageToken": "",\n "point": [\n {\n "computationTimeMillis": "",\n "dataTypeName": "",\n "endTimeNanos": "",\n "modifiedTimeMillis": "",\n "originDataSourceId": "",\n "rawTimestampNanos": "",\n "startTimeNanos": "",\n "value": [\n {\n "fpVal": "",\n "intVal": 0,\n "mapVal": [\n {\n "key": "",\n "value": {\n "fpVal": ""\n }\n }\n ],\n "stringVal": ""\n }\n ]\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"dataSourceId": "",
"maxEndTimeNs": "",
"minStartTimeNs": "",
"nextPageToken": "",
"point": [
[
"computationTimeMillis": "",
"dataTypeName": "",
"endTimeNanos": "",
"modifiedTimeMillis": "",
"originDataSourceId": "",
"rawTimestampNanos": "",
"startTimeNanos": "",
"value": [
[
"fpVal": "",
"intVal": 0,
"mapVal": [
[
"key": "",
"value": ["fpVal": ""]
]
],
"stringVal": ""
]
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources/:dataSourceId/datasets/:datasetId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
DELETE
fitness.users.dataSources.delete
{{baseUrl}}/:userId/dataSources/:dataSourceId
QUERY PARAMS
userId
dataSourceId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources/:dataSourceId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/:userId/dataSources/:dataSourceId")
require "http/client"
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/:userId/dataSources/:dataSourceId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/dataSources/:dataSourceId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources/:dataSourceId"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/:userId/dataSources/:dataSourceId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/:userId/dataSources/:dataSourceId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources/:dataSourceId"))
.method("DELETE", 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}}/:userId/dataSources/:dataSourceId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/:userId/dataSources/:dataSourceId")
.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('DELETE', '{{baseUrl}}/:userId/dataSources/:dataSourceId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId';
const options = {method: 'DELETE'};
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}}/:userId/dataSources/:dataSourceId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/dataSources/:dataSourceId',
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: 'DELETE',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/:userId/dataSources/:dataSourceId');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId';
const options = {method: 'DELETE'};
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}}/:userId/dataSources/:dataSourceId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
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}}/:userId/dataSources/:dataSourceId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources/:dataSourceId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/:userId/dataSources/:dataSourceId');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/:userId/dataSources/:dataSourceId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources/:dataSourceId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/dataSources/:dataSourceId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/:userId/dataSources/:dataSourceId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataSources/:dataSourceId";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/:userId/dataSources/:dataSourceId
http DELETE {{baseUrl}}/:userId/dataSources/:dataSourceId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/:userId/dataSources/:dataSourceId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources/:dataSourceId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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
fitness.users.dataSources.get
{{baseUrl}}/:userId/dataSources/:dataSourceId
QUERY PARAMS
userId
dataSourceId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources/:dataSourceId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:userId/dataSources/:dataSourceId")
require "http/client"
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId"
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}}/:userId/dataSources/:dataSourceId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/dataSources/:dataSourceId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources/:dataSourceId"
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/:userId/dataSources/:dataSourceId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:userId/dataSources/:dataSourceId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources/:dataSourceId"))
.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}}/:userId/dataSources/:dataSourceId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:userId/dataSources/:dataSourceId")
.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}}/:userId/dataSources/:dataSourceId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId';
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}}/:userId/dataSources/:dataSourceId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/dataSources/:dataSourceId',
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}}/:userId/dataSources/:dataSourceId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:userId/dataSources/:dataSourceId');
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}}/:userId/dataSources/:dataSourceId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId';
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}}/:userId/dataSources/:dataSourceId"]
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}}/:userId/dataSources/:dataSourceId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources/:dataSourceId",
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}}/:userId/dataSources/:dataSourceId');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:userId/dataSources/:dataSourceId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources/:dataSourceId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/dataSources/:dataSourceId")
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/:userId/dataSources/:dataSourceId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataSources/:dataSourceId";
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}}/:userId/dataSources/:dataSourceId
http GET {{baseUrl}}/:userId/dataSources/:dataSourceId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:userId/dataSources/:dataSourceId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources/:dataSourceId")! 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
fitness.users.dataSources.list
{{baseUrl}}/:userId/dataSources
QUERY PARAMS
userId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:userId/dataSources")
require "http/client"
url = "{{baseUrl}}/:userId/dataSources"
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}}/:userId/dataSources"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/dataSources");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources"
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/:userId/dataSources HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:userId/dataSources")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources"))
.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}}/:userId/dataSources")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:userId/dataSources")
.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}}/:userId/dataSources');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/:userId/dataSources'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources';
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}}/:userId/dataSources',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/dataSources',
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}}/:userId/dataSources'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:userId/dataSources');
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}}/:userId/dataSources'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources';
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}}/:userId/dataSources"]
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}}/:userId/dataSources" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources",
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}}/:userId/dataSources');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/dataSources');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/dataSources' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:userId/dataSources")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/dataSources")
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/:userId/dataSources') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataSources";
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}}/:userId/dataSources
http GET {{baseUrl}}/:userId/dataSources
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:userId/dataSources
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources")! 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()
PUT
fitness.users.dataSources.update
{{baseUrl}}/:userId/dataSources/:dataSourceId
QUERY PARAMS
userId
dataSourceId
BODY json
{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataSources/:dataSourceId");
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 \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/:userId/dataSources/:dataSourceId" {:content-type :json
:form-params {:application {:detailsUrl ""
:name ""
:packageName ""
:version ""}
:dataQualityStandard []
:dataStreamId ""
:dataStreamName ""
:dataType {:field [{:format ""
:name ""
:optional false}]
:name ""}
:device {:manufacturer ""
:model ""
:type ""
:uid ""
:version ""}
:name ""
:type ""}})
require "http/client"
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}"
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}}/:userId/dataSources/:dataSourceId"),
Content = new StringContent("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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}}/:userId/dataSources/:dataSourceId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataSources/:dataSourceId"
payload := strings.NewReader("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}")
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/:userId/dataSources/:dataSourceId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 459
{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/:userId/dataSources/:dataSourceId")
.setHeader("content-type", "application/json")
.setBody("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataSources/:dataSourceId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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 \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/:userId/dataSources/:dataSourceId")
.header("content-type", "application/json")
.body("{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}")
.asString();
const data = JSON.stringify({
application: {
detailsUrl: '',
name: '',
packageName: '',
version: ''
},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {
field: [
{
format: '',
name: '',
optional: false
}
],
name: ''
},
device: {
manufacturer: '',
model: '',
type: '',
uid: '',
version: ''
},
name: '',
type: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/:userId/dataSources/:dataSourceId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId',
headers: {'content-type': 'application/json'},
data: {
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"application":{"detailsUrl":"","name":"","packageName":"","version":""},"dataQualityStandard":[],"dataStreamId":"","dataStreamName":"","dataType":{"field":[{"format":"","name":"","optional":false}],"name":""},"device":{"manufacturer":"","model":"","type":"","uid":"","version":""},"name":"","type":""}'
};
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}}/:userId/dataSources/:dataSourceId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "application": {\n "detailsUrl": "",\n "name": "",\n "packageName": "",\n "version": ""\n },\n "dataQualityStandard": [],\n "dataStreamId": "",\n "dataStreamName": "",\n "dataType": {\n "field": [\n {\n "format": "",\n "name": "",\n "optional": false\n }\n ],\n "name": ""\n },\n "device": {\n "manufacturer": "",\n "model": "",\n "type": "",\n "uid": "",\n "version": ""\n },\n "name": "",\n "type": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataSources/:dataSourceId")
.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/:userId/dataSources/:dataSourceId',
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({
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/:userId/dataSources/:dataSourceId',
headers: {'content-type': 'application/json'},
body: {
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
},
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}}/:userId/dataSources/:dataSourceId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
application: {
detailsUrl: '',
name: '',
packageName: '',
version: ''
},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {
field: [
{
format: '',
name: '',
optional: false
}
],
name: ''
},
device: {
manufacturer: '',
model: '',
type: '',
uid: '',
version: ''
},
name: '',
type: ''
});
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}}/:userId/dataSources/:dataSourceId',
headers: {'content-type': 'application/json'},
data: {
application: {detailsUrl: '', name: '', packageName: '', version: ''},
dataQualityStandard: [],
dataStreamId: '',
dataStreamName: '',
dataType: {field: [{format: '', name: '', optional: false}], name: ''},
device: {manufacturer: '', model: '', type: '', uid: '', version: ''},
name: '',
type: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataSources/:dataSourceId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"application":{"detailsUrl":"","name":"","packageName":"","version":""},"dataQualityStandard":[],"dataStreamId":"","dataStreamName":"","dataType":{"field":[{"format":"","name":"","optional":false}],"name":""},"device":{"manufacturer":"","model":"","type":"","uid":"","version":""},"name":"","type":""}'
};
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 = @{ @"application": @{ @"detailsUrl": @"", @"name": @"", @"packageName": @"", @"version": @"" },
@"dataQualityStandard": @[ ],
@"dataStreamId": @"",
@"dataStreamName": @"",
@"dataType": @{ @"field": @[ @{ @"format": @"", @"name": @"", @"optional": @NO } ], @"name": @"" },
@"device": @{ @"manufacturer": @"", @"model": @"", @"type": @"", @"uid": @"", @"version": @"" },
@"name": @"",
@"type": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:userId/dataSources/:dataSourceId"]
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}}/:userId/dataSources/:dataSourceId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataSources/:dataSourceId",
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([
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'dataQualityStandard' => [
],
'dataStreamId' => '',
'dataStreamName' => '',
'dataType' => [
'field' => [
[
'format' => '',
'name' => '',
'optional' => null
]
],
'name' => ''
],
'device' => [
'manufacturer' => '',
'model' => '',
'type' => '',
'uid' => '',
'version' => ''
],
'name' => '',
'type' => ''
]),
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}}/:userId/dataSources/:dataSourceId', [
'body' => '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'dataQualityStandard' => [
],
'dataStreamId' => '',
'dataStreamName' => '',
'dataType' => [
'field' => [
[
'format' => '',
'name' => '',
'optional' => null
]
],
'name' => ''
],
'device' => [
'manufacturer' => '',
'model' => '',
'type' => '',
'uid' => '',
'version' => ''
],
'name' => '',
'type' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'dataQualityStandard' => [
],
'dataStreamId' => '',
'dataStreamName' => '',
'dataType' => [
'field' => [
[
'format' => '',
'name' => '',
'optional' => null
]
],
'name' => ''
],
'device' => [
'manufacturer' => '',
'model' => '',
'type' => '',
'uid' => '',
'version' => ''
],
'name' => '',
'type' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:userId/dataSources/:dataSourceId');
$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}}/:userId/dataSources/:dataSourceId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataSources/:dataSourceId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/:userId/dataSources/:dataSourceId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataSources/:dataSourceId"
payload = {
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": False
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataSources/:dataSourceId"
payload <- "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}"
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}}/:userId/dataSources/:dataSourceId")
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 = "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\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.put('/baseUrl/:userId/dataSources/:dataSourceId') do |req|
req.body = "{\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"dataQualityStandard\": [],\n \"dataStreamId\": \"\",\n \"dataStreamName\": \"\",\n \"dataType\": {\n \"field\": [\n {\n \"format\": \"\",\n \"name\": \"\",\n \"optional\": false\n }\n ],\n \"name\": \"\"\n },\n \"device\": {\n \"manufacturer\": \"\",\n \"model\": \"\",\n \"type\": \"\",\n \"uid\": \"\",\n \"version\": \"\"\n },\n \"name\": \"\",\n \"type\": \"\"\n}"
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}}/:userId/dataSources/:dataSourceId";
let payload = json!({
"application": json!({
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
}),
"dataQualityStandard": (),
"dataStreamId": "",
"dataStreamName": "",
"dataType": json!({
"field": (
json!({
"format": "",
"name": "",
"optional": false
})
),
"name": ""
}),
"device": json!({
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
}),
"name": "",
"type": ""
});
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}}/:userId/dataSources/:dataSourceId \
--header 'content-type: application/json' \
--data '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}'
echo '{
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": {
"field": [
{
"format": "",
"name": "",
"optional": false
}
],
"name": ""
},
"device": {
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
},
"name": "",
"type": ""
}' | \
http PUT {{baseUrl}}/:userId/dataSources/:dataSourceId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "application": {\n "detailsUrl": "",\n "name": "",\n "packageName": "",\n "version": ""\n },\n "dataQualityStandard": [],\n "dataStreamId": "",\n "dataStreamName": "",\n "dataType": {\n "field": [\n {\n "format": "",\n "name": "",\n "optional": false\n }\n ],\n "name": ""\n },\n "device": {\n "manufacturer": "",\n "model": "",\n "type": "",\n "uid": "",\n "version": ""\n },\n "name": "",\n "type": ""\n}' \
--output-document \
- {{baseUrl}}/:userId/dataSources/:dataSourceId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"application": [
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
],
"dataQualityStandard": [],
"dataStreamId": "",
"dataStreamName": "",
"dataType": [
"field": [
[
"format": "",
"name": "",
"optional": false
]
],
"name": ""
],
"device": [
"manufacturer": "",
"model": "",
"type": "",
"uid": "",
"version": ""
],
"name": "",
"type": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataSources/:dataSourceId")! 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()
POST
fitness.users.dataset.aggregate
{{baseUrl}}/:userId/dataset:aggregate
QUERY PARAMS
userId
BODY json
{
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": {
"minDurationMillis": ""
},
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/dataset:aggregate");
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 \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:userId/dataset:aggregate" {:content-type :json
:form-params {:aggregateBy [{:dataSourceId ""
:dataTypeName ""}]
:bucketByActivitySegment {:activityDataSourceId ""
:minDurationMillis ""}
:bucketByActivityType {}
:bucketBySession {:minDurationMillis ""}
:bucketByTime {:durationMillis ""
:period {:timeZoneId ""
:type ""
:value 0}}
:endTimeMillis ""
:filteredDataQualityStandard []
:startTimeMillis ""}})
require "http/client"
url = "{{baseUrl}}/:userId/dataset:aggregate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\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}}/:userId/dataset:aggregate"),
Content = new StringContent("{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\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}}/:userId/dataset:aggregate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/dataset:aggregate"
payload := strings.NewReader("{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\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/:userId/dataset:aggregate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 488
{
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": {
"minDurationMillis": ""
},
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:userId/dataset:aggregate")
.setHeader("content-type", "application/json")
.setBody("{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/dataset:aggregate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\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 \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:userId/dataset:aggregate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:userId/dataset:aggregate")
.header("content-type", "application/json")
.body("{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}")
.asString();
const data = JSON.stringify({
aggregateBy: [
{
dataSourceId: '',
dataTypeName: ''
}
],
bucketByActivitySegment: {
activityDataSourceId: '',
minDurationMillis: ''
},
bucketByActivityType: {},
bucketBySession: {
minDurationMillis: ''
},
bucketByTime: {
durationMillis: '',
period: {
timeZoneId: '',
type: '',
value: 0
}
},
endTimeMillis: '',
filteredDataQualityStandard: [],
startTimeMillis: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:userId/dataset:aggregate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:userId/dataset:aggregate',
headers: {'content-type': 'application/json'},
data: {
aggregateBy: [{dataSourceId: '', dataTypeName: ''}],
bucketByActivitySegment: {activityDataSourceId: '', minDurationMillis: ''},
bucketByActivityType: {},
bucketBySession: {minDurationMillis: ''},
bucketByTime: {durationMillis: '', period: {timeZoneId: '', type: '', value: 0}},
endTimeMillis: '',
filteredDataQualityStandard: [],
startTimeMillis: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/dataset:aggregate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"aggregateBy":[{"dataSourceId":"","dataTypeName":""}],"bucketByActivitySegment":{"activityDataSourceId":"","minDurationMillis":""},"bucketByActivityType":{},"bucketBySession":{"minDurationMillis":""},"bucketByTime":{"durationMillis":"","period":{"timeZoneId":"","type":"","value":0}},"endTimeMillis":"","filteredDataQualityStandard":[],"startTimeMillis":""}'
};
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}}/:userId/dataset:aggregate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "aggregateBy": [\n {\n "dataSourceId": "",\n "dataTypeName": ""\n }\n ],\n "bucketByActivitySegment": {\n "activityDataSourceId": "",\n "minDurationMillis": ""\n },\n "bucketByActivityType": {},\n "bucketBySession": {\n "minDurationMillis": ""\n },\n "bucketByTime": {\n "durationMillis": "",\n "period": {\n "timeZoneId": "",\n "type": "",\n "value": 0\n }\n },\n "endTimeMillis": "",\n "filteredDataQualityStandard": [],\n "startTimeMillis": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:userId/dataset:aggregate")
.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/:userId/dataset:aggregate',
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({
aggregateBy: [{dataSourceId: '', dataTypeName: ''}],
bucketByActivitySegment: {activityDataSourceId: '', minDurationMillis: ''},
bucketByActivityType: {},
bucketBySession: {minDurationMillis: ''},
bucketByTime: {durationMillis: '', period: {timeZoneId: '', type: '', value: 0}},
endTimeMillis: '',
filteredDataQualityStandard: [],
startTimeMillis: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:userId/dataset:aggregate',
headers: {'content-type': 'application/json'},
body: {
aggregateBy: [{dataSourceId: '', dataTypeName: ''}],
bucketByActivitySegment: {activityDataSourceId: '', minDurationMillis: ''},
bucketByActivityType: {},
bucketBySession: {minDurationMillis: ''},
bucketByTime: {durationMillis: '', period: {timeZoneId: '', type: '', value: 0}},
endTimeMillis: '',
filteredDataQualityStandard: [],
startTimeMillis: ''
},
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}}/:userId/dataset:aggregate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
aggregateBy: [
{
dataSourceId: '',
dataTypeName: ''
}
],
bucketByActivitySegment: {
activityDataSourceId: '',
minDurationMillis: ''
},
bucketByActivityType: {},
bucketBySession: {
minDurationMillis: ''
},
bucketByTime: {
durationMillis: '',
period: {
timeZoneId: '',
type: '',
value: 0
}
},
endTimeMillis: '',
filteredDataQualityStandard: [],
startTimeMillis: ''
});
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}}/:userId/dataset:aggregate',
headers: {'content-type': 'application/json'},
data: {
aggregateBy: [{dataSourceId: '', dataTypeName: ''}],
bucketByActivitySegment: {activityDataSourceId: '', minDurationMillis: ''},
bucketByActivityType: {},
bucketBySession: {minDurationMillis: ''},
bucketByTime: {durationMillis: '', period: {timeZoneId: '', type: '', value: 0}},
endTimeMillis: '',
filteredDataQualityStandard: [],
startTimeMillis: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/dataset:aggregate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"aggregateBy":[{"dataSourceId":"","dataTypeName":""}],"bucketByActivitySegment":{"activityDataSourceId":"","minDurationMillis":""},"bucketByActivityType":{},"bucketBySession":{"minDurationMillis":""},"bucketByTime":{"durationMillis":"","period":{"timeZoneId":"","type":"","value":0}},"endTimeMillis":"","filteredDataQualityStandard":[],"startTimeMillis":""}'
};
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 = @{ @"aggregateBy": @[ @{ @"dataSourceId": @"", @"dataTypeName": @"" } ],
@"bucketByActivitySegment": @{ @"activityDataSourceId": @"", @"minDurationMillis": @"" },
@"bucketByActivityType": @{ },
@"bucketBySession": @{ @"minDurationMillis": @"" },
@"bucketByTime": @{ @"durationMillis": @"", @"period": @{ @"timeZoneId": @"", @"type": @"", @"value": @0 } },
@"endTimeMillis": @"",
@"filteredDataQualityStandard": @[ ],
@"startTimeMillis": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:userId/dataset:aggregate"]
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}}/:userId/dataset:aggregate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/dataset:aggregate",
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([
'aggregateBy' => [
[
'dataSourceId' => '',
'dataTypeName' => ''
]
],
'bucketByActivitySegment' => [
'activityDataSourceId' => '',
'minDurationMillis' => ''
],
'bucketByActivityType' => [
],
'bucketBySession' => [
'minDurationMillis' => ''
],
'bucketByTime' => [
'durationMillis' => '',
'period' => [
'timeZoneId' => '',
'type' => '',
'value' => 0
]
],
'endTimeMillis' => '',
'filteredDataQualityStandard' => [
],
'startTimeMillis' => ''
]),
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}}/:userId/dataset:aggregate', [
'body' => '{
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": {
"minDurationMillis": ""
},
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/dataset:aggregate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'aggregateBy' => [
[
'dataSourceId' => '',
'dataTypeName' => ''
]
],
'bucketByActivitySegment' => [
'activityDataSourceId' => '',
'minDurationMillis' => ''
],
'bucketByActivityType' => [
],
'bucketBySession' => [
'minDurationMillis' => ''
],
'bucketByTime' => [
'durationMillis' => '',
'period' => [
'timeZoneId' => '',
'type' => '',
'value' => 0
]
],
'endTimeMillis' => '',
'filteredDataQualityStandard' => [
],
'startTimeMillis' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'aggregateBy' => [
[
'dataSourceId' => '',
'dataTypeName' => ''
]
],
'bucketByActivitySegment' => [
'activityDataSourceId' => '',
'minDurationMillis' => ''
],
'bucketByActivityType' => [
],
'bucketBySession' => [
'minDurationMillis' => ''
],
'bucketByTime' => [
'durationMillis' => '',
'period' => [
'timeZoneId' => '',
'type' => '',
'value' => 0
]
],
'endTimeMillis' => '',
'filteredDataQualityStandard' => [
],
'startTimeMillis' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:userId/dataset:aggregate');
$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}}/:userId/dataset:aggregate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": {
"minDurationMillis": ""
},
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/dataset:aggregate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": {
"minDurationMillis": ""
},
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:userId/dataset:aggregate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/dataset:aggregate"
payload = {
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": { "minDurationMillis": "" },
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/dataset:aggregate"
payload <- "{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\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}}/:userId/dataset:aggregate")
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 \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\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/:userId/dataset:aggregate') do |req|
req.body = "{\n \"aggregateBy\": [\n {\n \"dataSourceId\": \"\",\n \"dataTypeName\": \"\"\n }\n ],\n \"bucketByActivitySegment\": {\n \"activityDataSourceId\": \"\",\n \"minDurationMillis\": \"\"\n },\n \"bucketByActivityType\": {},\n \"bucketBySession\": {\n \"minDurationMillis\": \"\"\n },\n \"bucketByTime\": {\n \"durationMillis\": \"\",\n \"period\": {\n \"timeZoneId\": \"\",\n \"type\": \"\",\n \"value\": 0\n }\n },\n \"endTimeMillis\": \"\",\n \"filteredDataQualityStandard\": [],\n \"startTimeMillis\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/dataset:aggregate";
let payload = json!({
"aggregateBy": (
json!({
"dataSourceId": "",
"dataTypeName": ""
})
),
"bucketByActivitySegment": json!({
"activityDataSourceId": "",
"minDurationMillis": ""
}),
"bucketByActivityType": json!({}),
"bucketBySession": json!({"minDurationMillis": ""}),
"bucketByTime": json!({
"durationMillis": "",
"period": json!({
"timeZoneId": "",
"type": "",
"value": 0
})
}),
"endTimeMillis": "",
"filteredDataQualityStandard": (),
"startTimeMillis": ""
});
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}}/:userId/dataset:aggregate \
--header 'content-type: application/json' \
--data '{
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": {
"minDurationMillis": ""
},
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}'
echo '{
"aggregateBy": [
{
"dataSourceId": "",
"dataTypeName": ""
}
],
"bucketByActivitySegment": {
"activityDataSourceId": "",
"minDurationMillis": ""
},
"bucketByActivityType": {},
"bucketBySession": {
"minDurationMillis": ""
},
"bucketByTime": {
"durationMillis": "",
"period": {
"timeZoneId": "",
"type": "",
"value": 0
}
},
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
}' | \
http POST {{baseUrl}}/:userId/dataset:aggregate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "aggregateBy": [\n {\n "dataSourceId": "",\n "dataTypeName": ""\n }\n ],\n "bucketByActivitySegment": {\n "activityDataSourceId": "",\n "minDurationMillis": ""\n },\n "bucketByActivityType": {},\n "bucketBySession": {\n "minDurationMillis": ""\n },\n "bucketByTime": {\n "durationMillis": "",\n "period": {\n "timeZoneId": "",\n "type": "",\n "value": 0\n }\n },\n "endTimeMillis": "",\n "filteredDataQualityStandard": [],\n "startTimeMillis": ""\n}' \
--output-document \
- {{baseUrl}}/:userId/dataset:aggregate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"aggregateBy": [
[
"dataSourceId": "",
"dataTypeName": ""
]
],
"bucketByActivitySegment": [
"activityDataSourceId": "",
"minDurationMillis": ""
],
"bucketByActivityType": [],
"bucketBySession": ["minDurationMillis": ""],
"bucketByTime": [
"durationMillis": "",
"period": [
"timeZoneId": "",
"type": "",
"value": 0
]
],
"endTimeMillis": "",
"filteredDataQualityStandard": [],
"startTimeMillis": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/dataset:aggregate")! 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()
DELETE
fitness.users.sessions.delete
{{baseUrl}}/:userId/sessions/:sessionId
QUERY PARAMS
userId
sessionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/sessions/:sessionId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/:userId/sessions/:sessionId")
require "http/client"
url = "{{baseUrl}}/:userId/sessions/:sessionId"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/:userId/sessions/:sessionId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/sessions/:sessionId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/sessions/:sessionId"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/:userId/sessions/:sessionId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/:userId/sessions/:sessionId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/sessions/:sessionId"))
.method("DELETE", 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}}/:userId/sessions/:sessionId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/:userId/sessions/:sessionId")
.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('DELETE', '{{baseUrl}}/:userId/sessions/:sessionId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/:userId/sessions/:sessionId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/sessions/:sessionId';
const options = {method: 'DELETE'};
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}}/:userId/sessions/:sessionId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/sessions/:sessionId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/sessions/:sessionId',
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: 'DELETE',
url: '{{baseUrl}}/:userId/sessions/:sessionId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/:userId/sessions/:sessionId');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/:userId/sessions/:sessionId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/sessions/:sessionId';
const options = {method: 'DELETE'};
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}}/:userId/sessions/:sessionId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
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}}/:userId/sessions/:sessionId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/sessions/:sessionId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/:userId/sessions/:sessionId');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/sessions/:sessionId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/sessions/:sessionId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/sessions/:sessionId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/sessions/:sessionId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/:userId/sessions/:sessionId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/sessions/:sessionId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/sessions/:sessionId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/sessions/:sessionId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/:userId/sessions/:sessionId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/sessions/:sessionId";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/:userId/sessions/:sessionId
http DELETE {{baseUrl}}/:userId/sessions/:sessionId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/:userId/sessions/:sessionId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/sessions/:sessionId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
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
fitness.users.sessions.list
{{baseUrl}}/:userId/sessions
QUERY PARAMS
userId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/sessions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/:userId/sessions")
require "http/client"
url = "{{baseUrl}}/:userId/sessions"
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}}/:userId/sessions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:userId/sessions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/sessions"
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/:userId/sessions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/:userId/sessions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/sessions"))
.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}}/:userId/sessions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/:userId/sessions")
.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}}/:userId/sessions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/:userId/sessions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/sessions';
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}}/:userId/sessions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/:userId/sessions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/:userId/sessions',
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}}/:userId/sessions'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/:userId/sessions');
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}}/:userId/sessions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/sessions';
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}}/:userId/sessions"]
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}}/:userId/sessions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/sessions",
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}}/:userId/sessions');
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/sessions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/:userId/sessions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:userId/sessions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/sessions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/:userId/sessions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/sessions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/sessions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:userId/sessions")
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/:userId/sessions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:userId/sessions";
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}}/:userId/sessions
http GET {{baseUrl}}/:userId/sessions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/:userId/sessions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/sessions")! 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()
PUT
fitness.users.sessions.update
{{baseUrl}}/:userId/sessions/:sessionId
QUERY PARAMS
userId
sessionId
BODY json
{
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:userId/sessions/:sessionId");
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 \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/:userId/sessions/:sessionId" {:content-type :json
:form-params {:activeTimeMillis ""
:activityType 0
:application {:detailsUrl ""
:name ""
:packageName ""
:version ""}
:description ""
:endTimeMillis ""
:id ""
:modifiedTimeMillis ""
:name ""
:startTimeMillis ""}})
require "http/client"
url = "{{baseUrl}}/:userId/sessions/:sessionId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}"
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}}/:userId/sessions/:sessionId"),
Content = new StringContent("{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\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}}/:userId/sessions/:sessionId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:userId/sessions/:sessionId"
payload := strings.NewReader("{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}")
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/:userId/sessions/:sessionId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 275
{
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/:userId/sessions/:sessionId")
.setHeader("content-type", "application/json")
.setBody("{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:userId/sessions/:sessionId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\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 \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:userId/sessions/:sessionId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/:userId/sessions/:sessionId")
.header("content-type", "application/json")
.body("{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}")
.asString();
const data = JSON.stringify({
activeTimeMillis: '',
activityType: 0,
application: {
detailsUrl: '',
name: '',
packageName: '',
version: ''
},
description: '',
endTimeMillis: '',
id: '',
modifiedTimeMillis: '',
name: '',
startTimeMillis: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/:userId/sessions/:sessionId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/:userId/sessions/:sessionId',
headers: {'content-type': 'application/json'},
data: {
activeTimeMillis: '',
activityType: 0,
application: {detailsUrl: '', name: '', packageName: '', version: ''},
description: '',
endTimeMillis: '',
id: '',
modifiedTimeMillis: '',
name: '',
startTimeMillis: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:userId/sessions/:sessionId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"activeTimeMillis":"","activityType":0,"application":{"detailsUrl":"","name":"","packageName":"","version":""},"description":"","endTimeMillis":"","id":"","modifiedTimeMillis":"","name":"","startTimeMillis":""}'
};
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}}/:userId/sessions/:sessionId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "activeTimeMillis": "",\n "activityType": 0,\n "application": {\n "detailsUrl": "",\n "name": "",\n "packageName": "",\n "version": ""\n },\n "description": "",\n "endTimeMillis": "",\n "id": "",\n "modifiedTimeMillis": "",\n "name": "",\n "startTimeMillis": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:userId/sessions/:sessionId")
.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/:userId/sessions/:sessionId',
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({
activeTimeMillis: '',
activityType: 0,
application: {detailsUrl: '', name: '', packageName: '', version: ''},
description: '',
endTimeMillis: '',
id: '',
modifiedTimeMillis: '',
name: '',
startTimeMillis: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/:userId/sessions/:sessionId',
headers: {'content-type': 'application/json'},
body: {
activeTimeMillis: '',
activityType: 0,
application: {detailsUrl: '', name: '', packageName: '', version: ''},
description: '',
endTimeMillis: '',
id: '',
modifiedTimeMillis: '',
name: '',
startTimeMillis: ''
},
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}}/:userId/sessions/:sessionId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
activeTimeMillis: '',
activityType: 0,
application: {
detailsUrl: '',
name: '',
packageName: '',
version: ''
},
description: '',
endTimeMillis: '',
id: '',
modifiedTimeMillis: '',
name: '',
startTimeMillis: ''
});
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}}/:userId/sessions/:sessionId',
headers: {'content-type': 'application/json'},
data: {
activeTimeMillis: '',
activityType: 0,
application: {detailsUrl: '', name: '', packageName: '', version: ''},
description: '',
endTimeMillis: '',
id: '',
modifiedTimeMillis: '',
name: '',
startTimeMillis: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:userId/sessions/:sessionId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"activeTimeMillis":"","activityType":0,"application":{"detailsUrl":"","name":"","packageName":"","version":""},"description":"","endTimeMillis":"","id":"","modifiedTimeMillis":"","name":"","startTimeMillis":""}'
};
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 = @{ @"activeTimeMillis": @"",
@"activityType": @0,
@"application": @{ @"detailsUrl": @"", @"name": @"", @"packageName": @"", @"version": @"" },
@"description": @"",
@"endTimeMillis": @"",
@"id": @"",
@"modifiedTimeMillis": @"",
@"name": @"",
@"startTimeMillis": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:userId/sessions/:sessionId"]
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}}/:userId/sessions/:sessionId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:userId/sessions/:sessionId",
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([
'activeTimeMillis' => '',
'activityType' => 0,
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'description' => '',
'endTimeMillis' => '',
'id' => '',
'modifiedTimeMillis' => '',
'name' => '',
'startTimeMillis' => ''
]),
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}}/:userId/sessions/:sessionId', [
'body' => '{
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:userId/sessions/:sessionId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'activeTimeMillis' => '',
'activityType' => 0,
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'description' => '',
'endTimeMillis' => '',
'id' => '',
'modifiedTimeMillis' => '',
'name' => '',
'startTimeMillis' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'activeTimeMillis' => '',
'activityType' => 0,
'application' => [
'detailsUrl' => '',
'name' => '',
'packageName' => '',
'version' => ''
],
'description' => '',
'endTimeMillis' => '',
'id' => '',
'modifiedTimeMillis' => '',
'name' => '',
'startTimeMillis' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:userId/sessions/:sessionId');
$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}}/:userId/sessions/:sessionId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:userId/sessions/:sessionId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/:userId/sessions/:sessionId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:userId/sessions/:sessionId"
payload = {
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:userId/sessions/:sessionId"
payload <- "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}"
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}}/:userId/sessions/:sessionId")
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 = "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\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.put('/baseUrl/:userId/sessions/:sessionId') do |req|
req.body = "{\n \"activeTimeMillis\": \"\",\n \"activityType\": 0,\n \"application\": {\n \"detailsUrl\": \"\",\n \"name\": \"\",\n \"packageName\": \"\",\n \"version\": \"\"\n },\n \"description\": \"\",\n \"endTimeMillis\": \"\",\n \"id\": \"\",\n \"modifiedTimeMillis\": \"\",\n \"name\": \"\",\n \"startTimeMillis\": \"\"\n}"
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}}/:userId/sessions/:sessionId";
let payload = json!({
"activeTimeMillis": "",
"activityType": 0,
"application": json!({
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
}),
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
});
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}}/:userId/sessions/:sessionId \
--header 'content-type: application/json' \
--data '{
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}'
echo '{
"activeTimeMillis": "",
"activityType": 0,
"application": {
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
},
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
}' | \
http PUT {{baseUrl}}/:userId/sessions/:sessionId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "activeTimeMillis": "",\n "activityType": 0,\n "application": {\n "detailsUrl": "",\n "name": "",\n "packageName": "",\n "version": ""\n },\n "description": "",\n "endTimeMillis": "",\n "id": "",\n "modifiedTimeMillis": "",\n "name": "",\n "startTimeMillis": ""\n}' \
--output-document \
- {{baseUrl}}/:userId/sessions/:sessionId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"activeTimeMillis": "",
"activityType": 0,
"application": [
"detailsUrl": "",
"name": "",
"packageName": "",
"version": ""
],
"description": "",
"endTimeMillis": "",
"id": "",
"modifiedTimeMillis": "",
"name": "",
"startTimeMillis": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:userId/sessions/:sessionId")! 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()