Language

POST - Propose A New data Endpoint

https://testing.hubat.net/api/v2/combinator/android/locations

Data endpoints take data from existing datasets and combine multiple source, reformat data into different structures as per provided mapping, etc

Headers

Content Type

application/json

X-Auth-Token

Body




[
    {
        "endpoint": "rumpel/locations",
        "mapping": {
            "longitude": "data.locations.longitude",
            "latitude": "data.locations.latitude"
        }
    }
]


curl --request POST \
  --url https:///api/v2/data-bundle/localprofile \
  --header 'content-type: application/json' \
  --header 'x-auth-token: ' \
  --data '{"profile":{"endpoints":[{"endpoint":"rumpel/profile"}],"limit":1},"location":{"endpoints":[{"endpoint":"rumpel/locations","mapping":{"longitude":"data.locations.longitude","latitude":"data.locations.latitude"}}],"limit":5}}'
var data = JSON.stringify({
  "profile": {
    "endpoints": [
      {
        "endpoint": "rumpel/profile"
      }
    ],
    "limit": 1
  },
  "location": {
    "endpoints": [
      {
        "endpoint": "rumpel/locations",
        "mapping": {
          "longitude": "data.locations.longitude",
          "latitude": "data.locations.latitude"
        }
      }
    ],
    "limit": 5
  }
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https:///api/v2/data-bundle/localprofile");
xhr.setRequestHeader("x-auth-token", "");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https:///api/v2/data-bundle/localprofile",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\"profile\":{\"endpoints\":[{\"endpoint\":\"rumpel/profile\"}],\"limit\":1},\"location\":{\"endpoints\":[{\"endpoint\":\"rumpel/locations\",\"mapping\":{\"longitude\":\"data.locations.longitude\",\"latitude\":\"data.locations.latitude\"}}],\"limit\":5}}",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-token: "
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https:///api/v2/data-bundle/localprofile"

payload = "{\"profile\":{\"endpoints\":[{\"endpoint\":\"rumpel/profile\"}],\"limit\":1},\"location\":{\"endpoints\":[{\"endpoint\":\"rumpel/locations\",\"mapping\":{\"longitude\":\"data.locations.longitude\",\"latitude\":\"data.locations.latitude\"}}],\"limit\":5}}"
headers = {
    'x-auth-token': "",
    'content-type': "application/json"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
require 'uri'
require 'net/http'

url = URI("https:///api/v2/data-bundle/localprofile")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["x-auth-token"] = ''
request["content-type"] = 'application/json'
request.body = "{\"profile\":{\"endpoints\":[{\"endpoint\":\"rumpel/profile\"}],\"limit\":1},\"location\":{\"endpoints\":[{\"endpoint\":\"rumpel/locations\",\"mapping\":{\"longitude\":\"data.locations.longitude\",\"latitude\":\"data.locations.latitude\"}}],\"limit\":5}}"

response = http.request(request)
puts response.read_body

Example - Propose a new Data Endpoint - morning commute

https://testing.hubat.net/api/v2/combinator/locations/morningcommute

Headers

Content Type

application/json

X-Auth-Token

Body


[
    {
        "endpoint": "rumpel/locations",
        "filters": [
            {
                "field": "data.locations.timestamp",
                "transformation": {
                    "transformation": "datetimeExtract",
                    "part": "hour"
                },
                "operator": {
                    "operator": "between",
                    "lower": 7,
                    "upper": 9
                }
            }   
        ]
    }
]



curl --request POST \
  --url https:///api/v2/combinator/locations/morningcommute \
  --header 'content-type: application/json' \
  --header 'x-auth-token: ' \
  --data '[{"endpoint":"rumpel/locations","filters":[{"field":"data.locations.timestamp","transformation":{"transformation":"datetimeExtract","part":"hour"},"operator":{"operator":"between","lower":7,"upper":9}}]}]'
var data = JSON.stringify([
  {
    "endpoint": "rumpel/locations",
    "filters": [
      {
        "field": "data.locations.timestamp",
        "transformation": {
          "transformation": "datetimeExtract",
          "part": "hour"
        },
        "operator": {
          "operator": "between",
          "lower": 7,
          "upper": 9
        }
      }
    ]
  }
]);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https:///api/v2/combinator/locations/morningcommute");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("x-auth-token", "");

xhr.send(data);
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https:///api/v2/combinator/locations/morningcommute",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "[{\"endpoint\":\"rumpel/locations\",\"filters\":[{\"field\":\"data.locations.timestamp\",\"transformation\":{\"transformation\":\"datetimeExtract\",\"part\":\"hour\"},\"operator\":{\"operator\":\"between\",\"lower\":7,\"upper\":9}}]}]",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-token: "
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
import requests

url = "https:///api/v2/combinator/locations/morningcommute"

payload = "[{\"endpoint\":\"rumpel/locations\",\"filters\":[{\"field\":\"data.locations.timestamp\",\"transformation\":{\"transformation\":\"datetimeExtract\",\"part\":\"hour\"},\"operator\":{\"operator\":\"between\",\"lower\":7,\"upper\":9}}]}]"
headers = {
    'content-type': "application/json",
    'x-auth-token': ""
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
require 'uri'
require 'net/http'

url = URI("https:///api/v2/combinator/locations/morningcommute")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request["x-auth-token"] = ''
request.body = "[{\"endpoint\":\"rumpel/locations\",\"filters\":[{\"field\":\"data.locations.timestamp\",\"transformation\":{\"transformation\":\"datetimeExtract\",\"part\":\"hour\"},\"operator\":{\"operator\":\"between\",\"lower\":7,\"upper\":9}}]}]"

response = http.request(request)
puts response.read_body