Language

POST - Bulk-upload a large chunk of data to the same endpoint

https://testing.hubat.net/api/v2/data/rumpel/locations

Storing a ist of data records (locations in the example) in one go

Headers

Content-Type

application/json

X-Auth-Token

Body


[
  {
    "id": 85998,
    "name": "record 1",
    "lastUpdated": "2017-04-23T16:11:17.000Z",
    "data": {
      "locations": {
        "latitude": "51.671358277138",
        "longitude": "0.101014673709963",
        "accuracy": "10.0",
        "timestamp": "2017-04-23T16:11:17+0000"
      }
    }
  },
  {
    "id": 85997,
    "name": "record 3",
    "lastUpdated": "2017-04-23T16:18:04.000Z",
    "data": {
      "locations": {
        "latitude": "51.6658257133844",
        "longitude": "0.080477950927866",
        "accuracy": "1414.0",
        "timestamp": "2017-04-23T16:18:04+0000"
      }
    }
  },
  {
    "id": 85996,
    "name": "record 2",
    "lastUpdated": "2017-04-23T16:12:58.000Z",
    "data": {
      "locations": {
        "latitude": "51.674001392439",
        "longitude": "0.100905202634514",
        "accuracy": "1414.0",
        "timestamp": "2017-04-23T16:12:58+0000"
      }
    }
  }
]


curl --request POST \
  --url https:///api/v2/data/rumpel/locations \
  --header 'content-type: application/json' \
  --header 'x-auth-token: ' \
  --data '[{"id":85998,"name":"record 1","lastUpdated":"2017-04-23T16:11:17.000Z","data":{"locations":{"latitude":"51.671358277138","longitude":"0.101014673709963","accuracy":"10.0","timestamp":"2017-04-23T16:11:17+0000"}}},{"id":85997,"name":"record 3","lastUpdated":"2017-04-23T16:18:04.000Z","data":{"locations":{"latitude":"51.6658257133844","longitude":"0.080477950927866","accuracy":"1414.0","timestamp":"2017-04-23T16:18:04+0000"}}},{"id":85996,"name":"record 2","lastUpdated":"2017-04-23T16:12:58.000Z","data":{"locations":{"latitude":"51.674001392439","longitude":"0.100905202634514","accuracy":"1414.0","timestamp":"2017-04-23T16:12:58+0000"}}}]'
var data = JSON.stringify([
  {
    "id": 85998,
    "name": "record 1",
    "lastUpdated": "2017-04-23T16:11:17.000Z",
    "data": {
      "locations": {
        "latitude": "51.671358277138",
        "longitude": "0.101014673709963",
        "accuracy": "10.0",
        "timestamp": "2017-04-23T16:11:17+0000"
      }
    }
  },
  {
    "id": 85997,
    "name": "record 3",
    "lastUpdated": "2017-04-23T16:18:04.000Z",
    "data": {
      "locations": {
        "latitude": "51.6658257133844",
        "longitude": "0.080477950927866",
        "accuracy": "1414.0",
        "timestamp": "2017-04-23T16:18:04+0000"
      }
    }
  },
  {
    "id": 85996,
    "name": "record 2",
    "lastUpdated": "2017-04-23T16:12:58.000Z",
    "data": {
      "locations": {
        "latitude": "51.674001392439",
        "longitude": "0.100905202634514",
        "accuracy": "1414.0",
        "timestamp": "2017-04-23T16:12:58+0000"
      }
    }
  }
]);

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/rumpel/locations");
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/data/rumpel/locations",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "[{\"id\":85998,\"name\":\"record 1\",\"lastUpdated\":\"2017-04-23T16:11:17.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.671358277138\",\"longitude\":\"0.101014673709963\",\"accuracy\":\"10.0\",\"timestamp\":\"2017-04-23T16:11:17+0000\"}}},{\"id\":85997,\"name\":\"record 3\",\"lastUpdated\":\"2017-04-23T16:18:04.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.6658257133844\",\"longitude\":\"0.080477950927866\",\"accuracy\":\"1414.0\",\"timestamp\":\"2017-04-23T16:18:04+0000\"}}},{\"id\":85996,\"name\":\"record 2\",\"lastUpdated\":\"2017-04-23T16:12:58.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.674001392439\",\"longitude\":\"0.100905202634514\",\"accuracy\":\"1414.0\",\"timestamp\":\"2017-04-23T16:12:58+0000\"}}}]",
  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/rumpel/locations"

payload = "[{\"id\":85998,\"name\":\"record 1\",\"lastUpdated\":\"2017-04-23T16:11:17.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.671358277138\",\"longitude\":\"0.101014673709963\",\"accuracy\":\"10.0\",\"timestamp\":\"2017-04-23T16:11:17+0000\"}}},{\"id\":85997,\"name\":\"record 3\",\"lastUpdated\":\"2017-04-23T16:18:04.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.6658257133844\",\"longitude\":\"0.080477950927866\",\"accuracy\":\"1414.0\",\"timestamp\":\"2017-04-23T16:18:04+0000\"}}},{\"id\":85996,\"name\":\"record 2\",\"lastUpdated\":\"2017-04-23T16:12:58.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.674001392439\",\"longitude\":\"0.100905202634514\",\"accuracy\":\"1414.0\",\"timestamp\":\"2017-04-23T16:12:58+0000\"}}}]"
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/data/rumpel/locations")

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 = "[{\"id\":85998,\"name\":\"record 1\",\"lastUpdated\":\"2017-04-23T16:11:17.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.671358277138\",\"longitude\":\"0.101014673709963\",\"accuracy\":\"10.0\",\"timestamp\":\"2017-04-23T16:11:17+0000\"}}},{\"id\":85997,\"name\":\"record 3\",\"lastUpdated\":\"2017-04-23T16:18:04.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.6658257133844\",\"longitude\":\"0.080477950927866\",\"accuracy\":\"1414.0\",\"timestamp\":\"2017-04-23T16:18:04+0000\"}}},{\"id\":85996,\"name\":\"record 2\",\"lastUpdated\":\"2017-04-23T16:12:58.000Z\",\"data\":{\"locations\":{\"latitude\":\"51.674001392439\",\"longitude\":\"0.100905202634514\",\"accuracy\":\"1414.0\",\"timestamp\":\"2017-04-23T16:12:58+0000\"}}}]"

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

Example - Save Different Data

https://testing.hubat.net/api/v2/data/rumpel/profile

Using Rumpel profile as an exmaple, can save the whole object as a single API call

Headers

Content-Type

application/json

X-Auth-Token

Body



{"profile": {
        "website": {
          "link": "https://smart-e.org",
          "private": "false"
        },
        "nick": {
          "private": "true",
          "name": ""
        },
        "primary_email": {
          "value": "andrius.aucinas@hatdex.org",
          "private": "false"
        },
        "private": "false",
        "youtube": {
          "link": "",
          "private": "true"
        },
        "address_global": {
          "city": "London",
          "county": "",
          "country": "UK",
          "private": "true"
        },
        "linkedin": {
          "link": "https://www.linkedin.com/in/andriusaucinas",
          "private": "false"
        },
        "birth": {
          "private": "false",
          "date": "12 July"
        },
        "home_phone": {
          "no": "07593030685",
          "private": "true"
        },
        "google": {
          "link": "",
          "private": "true"
        },
        "age": {
          "group": "",
          "private": "true"
        },
        "personal": {
          "first_name": "",
          "private": "false",
          "preferred_name": "Andrius",
          "last_name": "Aucinas",
          "middle_name": "",
          "title": "Dr"
        },
        "blog": {
          "link": "https://smart-e.org/blog",
          "private": "false"
        },
        "facebook": {
          "link": "facebook.com/aucinas",
          "private": "false"
        },
        "address_details": {
          "no": "",
          "street": "",
          "private": "false",
          "postcode": ""
        },
        "emergency_contact": {
          "first_name": "",
          "private": "true",
          "relationship": "",
          "last_name": "",
          "mobile": ""
        },
        "alternative_email": {
          "private": "true",
          "value": ""
        },
        "fb_profile_photo": {
          "private": "false"
        },
        "twitter": {
          "link": "twitter.com/andriusa",
          "private": "false"
        },
        "about": {
          "body": "I am a co-founder and the Head of Engineering at the Hub of All Things (HAT). In the team I lead all engineering work on building the ecosystem, ranging across the full stack, cloud infrastructure, third-party resource integration while maintaining the team's flexibility and agility to adjust to business needs while pushing the boundaries of the most bleeding-edge technologies. I have earlier co-founded and was the CTO of Cambridge Coding Academy and finished a PhD (as well as BA) at the University of Cambridge.",
          "private": "false",
          "title": "Andrius Aucinas"
        },
        "mobile": {
          "no": "",
          "private": "true"
        },
        "gender": {
          "type": "",
          "private": "true"
        }
      }}



curl --request POST \
  --url https:///api/v2/data/rumpel/profile \
  --header 'content-type: application/json' \
  --header 'x-auth-token: ' \
  --data '{"profile":{"website":{"link":"https://smart-e.org","private":"false"},"nick":{"private":"true","name":""},"primary_email":{"value":"andrius.aucinas@hatdex.org","private":"false"},"private":"false","youtube":{"link":"","private":"true"},"address_global":{"city":"London","county":"","country":"UK","private":"true"},"linkedin":{"link":"https://www.linkedin.com/in/andriusaucinas","private":"false"},"birth":{"private":"false","date":"12 July"},"home_phone":{"no":"07593030685","private":"true"},"google":{"link":"","private":"true"},"age":{"group":"","private":"true"},"personal":{"first_name":"","private":"false","preferred_name":"Andrius","last_name":"Aucinas","middle_name":"","title":"Dr"},"blog":{"link":"https://smart-e.org/blog","private":"false"},"facebook":{"link":"facebook.com/aucinas","private":"false"},"address_details":{"no":"","street":"","private":"false","postcode":""},"emergency_contact":{"first_name":"","private":"true","relationship":"","last_name":"","mobile":""},"alternative_email":{"private":"true","value":""},"fb_profile_photo":{"private":"false"},"twitter":{"link":"twitter.com/andriusa","private":"false"},"about":{"body":"I am a co-founder and the Head of Engineering at the Hub of All Things (HAT). In the team I lead all engineering work on building the ecosystem, ranging across the full stack, cloud infrastructure, third-party resource integration while maintaining the team'\''s flexibility and agility to adjust to business needs while pushing the boundaries of the most bleeding-edge technologies. I have earlier co-founded and was the CTO of Cambridge Coding Academy and finished a PhD (as well as BA) at the University of Cambridge.","private":"false","title":"Andrius Aucinas"},"mobile":{"no":"","private":"true"},"gender":{"type":"","private":"true"}}}'
var data = JSON.stringify({
  "profile": {
    "website": {
      "link": "https://smart-e.org",
      "private": "false"
    },
    "nick": {
      "private": "true",
      "name": ""
    },
    "primary_email": {
      "value": "andrius.aucinas@hatdex.org",
      "private": "false"
    },
    "private": "false",
    "youtube": {
      "link": "",
      "private": "true"
    },
    "address_global": {
      "city": "London",
      "county": "",
      "country": "UK",
      "private": "true"
    },
    "linkedin": {
      "link": "https://www.linkedin.com/in/andriusaucinas",
      "private": "false"
    },
    "birth": {
      "private": "false",
      "date": "12 July"
    },
    "home_phone": {
      "no": "07593030685",
      "private": "true"
    },
    "google": {
      "link": "",
      "private": "true"
    },
    "age": {
      "group": "",
      "private": "true"
    },
    "personal": {
      "first_name": "",
      "private": "false",
      "preferred_name": "Andrius",
      "last_name": "Aucinas",
      "middle_name": "",
      "title": "Dr"
    },
    "blog": {
      "link": "https://smart-e.org/blog",
      "private": "false"
    },
    "facebook": {
      "link": "facebook.com/aucinas",
      "private": "false"
    },
    "address_details": {
      "no": "",
      "street": "",
      "private": "false",
      "postcode": ""
    },
    "emergency_contact": {
      "first_name": "",
      "private": "true",
      "relationship": "",
      "last_name": "",
      "mobile": ""
    },
    "alternative_email": {
      "private": "true",
      "value": ""
    },
    "fb_profile_photo": {
      "private": "false"
    },
    "twitter": {
      "link": "twitter.com/andriusa",
      "private": "false"
    },
    "about": {
      "body": "I am a co-founder and the Head of Engineering at the Hub of All Things (HAT). In the team I lead all engineering work on building the ecosystem, ranging across the full stack, cloud infrastructure, third-party resource integration while maintaining the team's flexibility and agility to adjust to business needs while pushing the boundaries of the most bleeding-edge technologies. I have earlier co-founded and was the CTO of Cambridge Coding Academy and finished a PhD (as well as BA) at the University of Cambridge.",
      "private": "false",
      "title": "Andrius Aucinas"
    },
    "mobile": {
      "no": "",
      "private": "true"
    },
    "gender": {
      "type": "",
      "private": "true"
    }
  }
});

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/rumpel/profile");
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/data/rumpel/profile",
  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\":{\"website\":{\"link\":\"https://smart-e.org\",\"private\":\"false\"},\"nick\":{\"private\":\"true\",\"name\":\"\"},\"primary_email\":{\"value\":\"andrius.aucinas@hatdex.org\",\"private\":\"false\"},\"private\":\"false\",\"youtube\":{\"link\":\"\",\"private\":\"true\"},\"address_global\":{\"city\":\"London\",\"county\":\"\",\"country\":\"UK\",\"private\":\"true\"},\"linkedin\":{\"link\":\"https://www.linkedin.com/in/andriusaucinas\",\"private\":\"false\"},\"birth\":{\"private\":\"false\",\"date\":\"12 July\"},\"home_phone\":{\"no\":\"07593030685\",\"private\":\"true\"},\"google\":{\"link\":\"\",\"private\":\"true\"},\"age\":{\"group\":\"\",\"private\":\"true\"},\"personal\":{\"first_name\":\"\",\"private\":\"false\",\"preferred_name\":\"Andrius\",\"last_name\":\"Aucinas\",\"middle_name\":\"\",\"title\":\"Dr\"},\"blog\":{\"link\":\"https://smart-e.org/blog\",\"private\":\"false\"},\"facebook\":{\"link\":\"facebook.com/aucinas\",\"private\":\"false\"},\"address_details\":{\"no\":\"\",\"street\":\"\",\"private\":\"false\",\"postcode\":\"\"},\"emergency_contact\":{\"first_name\":\"\",\"private\":\"true\",\"relationship\":\"\",\"last_name\":\"\",\"mobile\":\"\"},\"alternative_email\":{\"private\":\"true\",\"value\":\"\"},\"fb_profile_photo\":{\"private\":\"false\"},\"twitter\":{\"link\":\"twitter.com/andriusa\",\"private\":\"false\"},\"about\":{\"body\":\"I am a co-founder and the Head of Engineering at the Hub of All Things (HAT). In the team I lead all engineering work on building the ecosystem, ranging across the full stack, cloud infrastructure, third-party resource integration while maintaining the team's flexibility and agility to adjust to business needs while pushing the boundaries of the most bleeding-edge technologies. I have earlier co-founded and was the CTO of Cambridge Coding Academy and finished a PhD (as well as BA) at the University of Cambridge.\",\"private\":\"false\",\"title\":\"Andrius Aucinas\"},\"mobile\":{\"no\":\"\",\"private\":\"true\"},\"gender\":{\"type\":\"\",\"private\":\"true\"}}}",
  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/rumpel/profile"

payload = "{\"profile\":{\"website\":{\"link\":\"https://smart-e.org\",\"private\":\"false\"},\"nick\":{\"private\":\"true\",\"name\":\"\"},\"primary_email\":{\"value\":\"andrius.aucinas@hatdex.org\",\"private\":\"false\"},\"private\":\"false\",\"youtube\":{\"link\":\"\",\"private\":\"true\"},\"address_global\":{\"city\":\"London\",\"county\":\"\",\"country\":\"UK\",\"private\":\"true\"},\"linkedin\":{\"link\":\"https://www.linkedin.com/in/andriusaucinas\",\"private\":\"false\"},\"birth\":{\"private\":\"false\",\"date\":\"12 July\"},\"home_phone\":{\"no\":\"07593030685\",\"private\":\"true\"},\"google\":{\"link\":\"\",\"private\":\"true\"},\"age\":{\"group\":\"\",\"private\":\"true\"},\"personal\":{\"first_name\":\"\",\"private\":\"false\",\"preferred_name\":\"Andrius\",\"last_name\":\"Aucinas\",\"middle_name\":\"\",\"title\":\"Dr\"},\"blog\":{\"link\":\"https://smart-e.org/blog\",\"private\":\"false\"},\"facebook\":{\"link\":\"facebook.com/aucinas\",\"private\":\"false\"},\"address_details\":{\"no\":\"\",\"street\":\"\",\"private\":\"false\",\"postcode\":\"\"},\"emergency_contact\":{\"first_name\":\"\",\"private\":\"true\",\"relationship\":\"\",\"last_name\":\"\",\"mobile\":\"\"},\"alternative_email\":{\"private\":\"true\",\"value\":\"\"},\"fb_profile_photo\":{\"private\":\"false\"},\"twitter\":{\"link\":\"twitter.com/andriusa\",\"private\":\"false\"},\"about\":{\"body\":\"I am a co-founder and the Head of Engineering at the Hub of All Things (HAT). In the team I lead all engineering work on building the ecosystem, ranging across the full stack, cloud infrastructure, third-party resource integration while maintaining the team's flexibility and agility to adjust to business needs while pushing the boundaries of the most bleeding-edge technologies. I have earlier co-founded and was the CTO of Cambridge Coding Academy and finished a PhD (as well as BA) at the University of Cambridge.\",\"private\":\"false\",\"title\":\"Andrius Aucinas\"},\"mobile\":{\"no\":\"\",\"private\":\"true\"},\"gender\":{\"type\":\"\",\"private\":\"true\"}}}"
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/data/rumpel/profile")

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 = "{\"profile\":{\"website\":{\"link\":\"https://smart-e.org\",\"private\":\"false\"},\"nick\":{\"private\":\"true\",\"name\":\"\"},\"primary_email\":{\"value\":\"andrius.aucinas@hatdex.org\",\"private\":\"false\"},\"private\":\"false\",\"youtube\":{\"link\":\"\",\"private\":\"true\"},\"address_global\":{\"city\":\"London\",\"county\":\"\",\"country\":\"UK\",\"private\":\"true\"},\"linkedin\":{\"link\":\"https://www.linkedin.com/in/andriusaucinas\",\"private\":\"false\"},\"birth\":{\"private\":\"false\",\"date\":\"12 July\"},\"home_phone\":{\"no\":\"07593030685\",\"private\":\"true\"},\"google\":{\"link\":\"\",\"private\":\"true\"},\"age\":{\"group\":\"\",\"private\":\"true\"},\"personal\":{\"first_name\":\"\",\"private\":\"false\",\"preferred_name\":\"Andrius\",\"last_name\":\"Aucinas\",\"middle_name\":\"\",\"title\":\"Dr\"},\"blog\":{\"link\":\"https://smart-e.org/blog\",\"private\":\"false\"},\"facebook\":{\"link\":\"facebook.com/aucinas\",\"private\":\"false\"},\"address_details\":{\"no\":\"\",\"street\":\"\",\"private\":\"false\",\"postcode\":\"\"},\"emergency_contact\":{\"first_name\":\"\",\"private\":\"true\",\"relationship\":\"\",\"last_name\":\"\",\"mobile\":\"\"},\"alternative_email\":{\"private\":\"true\",\"value\":\"\"},\"fb_profile_photo\":{\"private\":\"false\"},\"twitter\":{\"link\":\"twitter.com/andriusa\",\"private\":\"false\"},\"about\":{\"body\":\"I am a co-founder and the Head of Engineering at the Hub of All Things (HAT). In the team I lead all engineering work on building the ecosystem, ranging across the full stack, cloud infrastructure, third-party resource integration while maintaining the team's flexibility and agility to adjust to business needs while pushing the boundaries of the most bleeding-edge technologies. I have earlier co-founded and was the CTO of Cambridge Coding Academy and finished a PhD (as well as BA) at the University of Cambridge.\",\"private\":\"false\",\"title\":\"Andrius Aucinas\"},\"mobile\":{\"no\":\"\",\"private\":\"true\"},\"gender\":{\"type\":\"\",\"private\":\"true\"}}}"

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