
curl –request POST \
–url https://api.taskware.io/annotations \
–header ‘accept: application/vnd.api+json; version=1’ \
–header ‘content-type: application/vnd.api+json’ \
–header ‘x-api-key: TASKWARE-TEST-API-TOKEN’ \
–data ‘{“data”:{“type”:”annotations”,”attributes”:{“annotations”:[“cat”,”dog”],”bounding-box”:{“min-height”:10,”min-width”:10,”include-labels”:true},”guidelines”:”Draw bounding boxes around all individual cats and dogs. Choose the appropriate annotation for each box.”,”callback-url”:”http://example.com”,”media”:{“type”:”image”,”source”:”http://example.com/image.png”}}}}’
var data = JSON.stringify({
“data”: {
“type”: “comparisons”,
“attributes”: {
“dictionary”: {
“unique”: [
{
“answer”: “Are these images of the same type of fruit?”,
“options”: {
“values”: [
“Yes”,
“No”
],
“single_choice”: true
}
}
] },
“guidelines”: “Select whether or not both images are the same type of fruit”,
“callback-url”: “http://example.com”,
“flow-id”: “AP300COMPTA”,
“media”: [
{
“type”: “image”,
“source”: “http://example.com/image1.jpg”
},
{
“type”: “image”,
“source”: “http://example.com/image2.jpg”
}
] }
}
});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.taskware.io/comparisons”);
xhr.setRequestHeader(“x-api-key”, “TASKWARE-TEST-API-TOKEN”);
xhr.setRequestHeader(“content-type”, “application/vnd.api+json”);
xhr.setRequestHeader(“accept”, “application/vnd.api+json; version=1”);
xhr.send(data);
import http.client
conn = http.client.HTTPSConnection(“api.taskware.io”)
payload = “{\”data\”:{\”type\”:\”comparisons\”,\”attributes\”:{\”dictionary\”:{\”unique\”:[{\”answer\”:\”Are these images of the same type of fruit?\”,\”options\”:{\”values\”:[\”Yes\”,\”No\”],\”single_choice\”:true}}]},\”guidelines\”:\”Select whether or not both images are the same type of fruit\”,\”callback-url\”:\”http://example.com\”,\”flow-id\”:\”AP300COMPTA\”,\”media\”:[{\”type\”:\”image\”,\”source\”:\”http://example.com/image1.jpg\”},{\”type\”:\”image\”,\”source\”:\”http://example.com/image2.jpg\”}]}}}”headers = {
‘x-api-key’: “TASKWARE-TEST-API-TOKEN”,
‘content-type’: “application/vnd.api+json”,
‘accept’: “application/vnd.api+json; version=1”
}conn.request(“POST”, “/comparisons”, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8”))
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONErequest = Net::HTTP::Post.new(url)
request[“x-api-key”] = ‘TASKWARE-TEST-API-TOKEN’
request[“content-type”] = ‘application/vnd.api+json’
request[“accept”] = ‘application/vnd.api+json; version=1’
request.body = “{\”data\”:{\”type\”:\”comparisons\”,\”attributes\”:{\”dictionary\”:{\”unique\”:[{\”answer\”:\”Are these images of the same type of fruit?\”,\”options\”:{\”values\”:[\”Yes\”,\”No\”],\”single_choice\”:true}}]},\”guidelines\”:\”Select whether or not both images are the same type of fruit\”,\”callback-url\”:\”http://example.com\”,\”flow-id\”:\”AP300COMPTA\”,\”media\”:[{\”type\”:\”image\”,\”source\”:\”http://example.com/image1.jpg\”},{\”type\”:\”image\”,\”source\”:\”http://example.com/image2.jpg\”}]}}}”response = http.request(request)
puts response.read_body