Language

Your data requirements may change over time, so what are your options in making sure they are reflected in your relationship with the individual HAT owner?

  1. Request a new Data Debit with the updated requirements
  2. Update an existing Data Debit

The latter option has the benefit of you building on the existing relationship with the individual: they see the scope of your request increasing, however they will recognise you as somebody they have already agreed to share data with. If you choose this option, you need to submit an updated Data Debit request by calling PUT /api/v2/data-debit/DATA_DEBIT_ID.

This example simply requests for more of the most recent locations, increasing the limit from 5 to 10:

curl --request PUT \
  --url https://test.hubat.net/api/v2/data-debit/userprofile \
  --header 'content-type: application/json' \
  --header 'x-auth-token: ACCESS_TOKEN' \
  --data '{"bundle":{"name":"userprofilebigger","bundle":{"profile":{"endpoints":[{"endpoint":"rumpel/profile"}],"limit":1},"location":{"endpoints":[{"endpoint":"rumpel/locations","mapping":{"longitude":"data.locations.longitude","latitude":"data.locations.latitude"}}],"limit":10}}},"startDate":"2017-05-13T09:32:47+00:00","endDate":"2017-06-13T09:32:47+00:00","rolling":false}'
var data = JSON.stringify({
  "bundle": {
    "name": "userprofilebigger",
    "bundle": {
      "profile": {
        "endpoints": [
          {
            "endpoint": "rumpel/profile"
          }
        ],
        "limit": 1
      },
      "location": {
        "endpoints": [
          {
            "endpoint": "rumpel/locations",
            "mapping": {
              "longitude": "data.locations.longitude",
              "latitude": "data.locations.latitude"
            }
          }
        ],
        "limit": 10
      }
    }
  },
  "startDate": "2017-05-13T09:32:47+00:00",
  "endDate": "2017-06-13T09:32:47+00:00",
  "rolling": false
});

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

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

xhr.open("PUT", "https://test.hubat.net/api/v2/data-debit/userprofile");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("x-auth-token", "ACCESS_TOKEN");

xhr.send(data);
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://test.hubat.net/api/v2/data-debit/userprofile",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => "{\"bundle\":{\"name\":\"userprofilebigger\",\"bundle\":{\"profile\":{\"endpoints\":[{\"endpoint\":\"rumpel/profile\"}],\"limit\":1},\"location\":{\"endpoints\":[{\"endpoint\":\"rumpel/locations\",\"mapping\":{\"longitude\":\"data.locations.longitude\",\"latitude\":\"data.locations.latitude\"}}],\"limit\":10}}},\"startDate\":\"2017-05-13T09:32:47+00:00\",\"endDate\":\"2017-06-13T09:32:47+00:00\",\"rolling\":false}",
  CURLOPT_HTTPHEADER => array(
    "content-type: application/json",
    "x-auth-token: ACCESS_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://test.hubat.net/api/v2/data-debit/userprofile"

payload = "{\"bundle\":{\"name\":\"userprofilebigger\",\"bundle\":{\"profile\":{\"endpoints\":[{\"endpoint\":\"rumpel/profile\"}],\"limit\":1},\"location\":{\"endpoints\":[{\"endpoint\":\"rumpel/locations\",\"mapping\":{\"longitude\":\"data.locations.longitude\",\"latitude\":\"data.locations.latitude\"}}],\"limit\":10}}},\"startDate\":\"2017-05-13T09:32:47+00:00\",\"endDate\":\"2017-06-13T09:32:47+00:00\",\"rolling\":false}"
headers = {
    'content-type': "application/json",
    'x-auth-token': "ACCESS_TOKEN"
    }

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

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

url = URI("https://test.hubat.net/api/v2/data-debit/userprofile")

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

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["x-auth-token"] = 'ACCESS_TOKEN'
request.body = "{\"bundle\":{\"name\":\"userprofilebigger\",\"bundle\":{\"profile\":{\"endpoints\":[{\"endpoint\":\"rumpel/profile\"}],\"limit\":1},\"location\":{\"endpoints\":[{\"endpoint\":\"rumpel/locations\",\"mapping\":{\"longitude\":\"data.locations.longitude\",\"latitude\":\"data.locations.latitude\"}}],\"limit\":10}}},\"startDate\":\"2017-05-13T09:32:47+00:00\",\"endDate\":\"2017-06-13T09:32:47+00:00\",\"rolling\":false}"

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