Custom Vision Prediction Client
POST
Classify an image and saves the result.
{{baseUrl}}/:projectId/classify/iterations/:publishedName/image
QUERY PARAMS
projectId
publishedName
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image" {:multipart [{:name "imageData"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image"
headers = HTTP::Headers{
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\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}}/:projectId/classify/iterations/:publishedName/image"),
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "imageData",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectId/classify/iterations/:publishedName/image HTTP/1.1
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 118
-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image"))
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('imageData', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('imageData', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image';
const form = new FormData();
form.append('imageData', '');
const options = {method: 'POST'};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('imageData', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image',
method: 'POST',
headers: {},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectId/classify/iterations/:publishedName/image',
headers: {
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
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('-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
formData: {imageData: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image');
req.headers({
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
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}}/:projectId/classify/iterations/:publishedName/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('imageData', '');
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image';
const options = {method: 'POST'};
options.body = formData;
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": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"imageData", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/classify/iterations/:publishedName/image"]
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}}/:projectId/classify/iterations/:publishedName/image" in
let headers = Header.add (Header.init ()) "content-type" "multipart/form-data; boundary=---011000010111000001101001" in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/classify/iterations/:publishedName/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/image');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/image');
$request->setRequestMethod('POST');
$request->setBody($body);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/baseUrl/:projectId/classify/iterations/:publishedName/image", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/:projectId/classify/iterations/:publishedName/image') do |req|
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image";
let form = reqwest::multipart::Form::new()
.text("imageData", "");
let mut headers = reqwest::header::HeaderMap::new();
let client = reqwest::Client::new();
let response = client.post(url)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectId/classify/iterations/:publishedName/image \
--header 'content-type: multipart/form-data' \
--form imageData=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
' | \
http POST {{baseUrl}}/:projectId/classify/iterations/:publishedName/image \
content-type:'multipart/form-data; boundary=---011000010111000001101001'
wget --quiet \
--method POST \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- {{baseUrl}}/:projectId/classify/iterations/:publishedName/image
import Foundation
let headers = ["content-type": "multipart/form-data; boundary=---011000010111000001101001"]
let parameters = [
[
"name": "imageData",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
POST
Classify an image url and saves the result.
{{baseUrl}}/:projectId/classify/iterations/:publishedName/url
QUERY PARAMS
projectId
publishedName
BODY json
{
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url");
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 \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url" {:content-type :json
:form-params {:url ""}})
require "http/client"
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"url\": \"\"\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}}/:projectId/classify/iterations/:publishedName/url"),
Content = new StringContent("{\n \"url\": \"\"\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}}/:projectId/classify/iterations/:publishedName/url");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url"
payload := strings.NewReader("{\n \"url\": \"\"\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/:projectId/classify/iterations/:publishedName/url HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 15
{
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url")
.setHeader("content-type", "application/json")
.setBody("{\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"url\": \"\"\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 \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url")
.header("content-type", "application/json")
.body("{\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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}}/:projectId/classify/iterations/:publishedName/url',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url")
.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/:projectId/classify/iterations/:publishedName/url',
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({url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url',
headers: {'content-type': 'application/json'},
body: {url: ''},
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}}/:projectId/classify/iterations/:publishedName/url');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
url: ''
});
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}}/:projectId/classify/iterations/:publishedName/url',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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 = @{ @"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/classify/iterations/:publishedName/url"]
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}}/:projectId/classify/iterations/:publishedName/url" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/classify/iterations/:publishedName/url",
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([
'url' => ''
]),
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}}/:projectId/classify/iterations/:publishedName/url', [
'body' => '{
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/url');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/url');
$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}}/:projectId/classify/iterations/:publishedName/url' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"url\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectId/classify/iterations/:publishedName/url", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url"
payload = { "url": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url"
payload <- "{\n \"url\": \"\"\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}}/:projectId/classify/iterations/:publishedName/url")
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 \"url\": \"\"\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/:projectId/classify/iterations/:publishedName/url') do |req|
req.body = "{\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url";
let payload = json!({"url": ""});
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}}/:projectId/classify/iterations/:publishedName/url \
--header 'content-type: application/json' \
--data '{
"url": ""
}'
echo '{
"url": ""
}' | \
http POST {{baseUrl}}/:projectId/classify/iterations/:publishedName/url \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/:projectId/classify/iterations/:publishedName/url
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["url": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
POST
Classify an image url without saving the result.
{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore
QUERY PARAMS
projectId
publishedName
BODY json
{
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore");
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 \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore" {:content-type :json
:form-params {:url ""}})
require "http/client"
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"url\": \"\"\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}}/:projectId/classify/iterations/:publishedName/url/nostore"),
Content = new StringContent("{\n \"url\": \"\"\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}}/:projectId/classify/iterations/:publishedName/url/nostore");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore"
payload := strings.NewReader("{\n \"url\": \"\"\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/:projectId/classify/iterations/:publishedName/url/nostore HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 15
{
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore")
.setHeader("content-type", "application/json")
.setBody("{\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"url\": \"\"\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 \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore")
.header("content-type", "application/json")
.body("{\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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}}/:projectId/classify/iterations/:publishedName/url/nostore',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore")
.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/:projectId/classify/iterations/:publishedName/url/nostore',
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({url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore',
headers: {'content-type': 'application/json'},
body: {url: ''},
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}}/:projectId/classify/iterations/:publishedName/url/nostore');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
url: ''
});
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}}/:projectId/classify/iterations/:publishedName/url/nostore',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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 = @{ @"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore"]
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}}/:projectId/classify/iterations/:publishedName/url/nostore" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore",
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([
'url' => ''
]),
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}}/:projectId/classify/iterations/:publishedName/url/nostore', [
'body' => '{
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore');
$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}}/:projectId/classify/iterations/:publishedName/url/nostore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"url\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectId/classify/iterations/:publishedName/url/nostore", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore"
payload = { "url": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore"
payload <- "{\n \"url\": \"\"\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}}/:projectId/classify/iterations/:publishedName/url/nostore")
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 \"url\": \"\"\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/:projectId/classify/iterations/:publishedName/url/nostore') do |req|
req.body = "{\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore";
let payload = json!({"url": ""});
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}}/:projectId/classify/iterations/:publishedName/url/nostore \
--header 'content-type: application/json' \
--data '{
"url": ""
}'
echo '{
"url": ""
}' | \
http POST {{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["url": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/classify/iterations/:publishedName/url/nostore")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
POST
Classify an image without saving the result.
{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore
QUERY PARAMS
projectId
publishedName
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore" {:multipart [{:name "imageData"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore"
headers = HTTP::Headers{
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\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}}/:projectId/classify/iterations/:publishedName/image/nostore"),
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "imageData",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectId/classify/iterations/:publishedName/image/nostore HTTP/1.1
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 118
-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore"))
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('imageData', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('imageData', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore';
const form = new FormData();
form.append('imageData', '');
const options = {method: 'POST'};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('imageData', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore',
method: 'POST',
headers: {},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectId/classify/iterations/:publishedName/image/nostore',
headers: {
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
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('-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
formData: {imageData: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore');
req.headers({
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
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}}/:projectId/classify/iterations/:publishedName/image/nostore',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('imageData', '');
const url = '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore';
const options = {method: 'POST'};
options.body = formData;
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": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"imageData", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore"]
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}}/:projectId/classify/iterations/:publishedName/image/nostore" in
let headers = Header.add (Header.init ()) "content-type" "multipart/form-data; boundary=---011000010111000001101001" in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore');
$request->setRequestMethod('POST');
$request->setBody($body);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/baseUrl/:projectId/classify/iterations/:publishedName/image/nostore", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/:projectId/classify/iterations/:publishedName/image/nostore') do |req|
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore";
let form = reqwest::multipart::Form::new()
.text("imageData", "");
let mut headers = reqwest::header::HeaderMap::new();
let client = reqwest::Client::new();
let response = client.post(url)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore \
--header 'content-type: multipart/form-data' \
--form imageData=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
' | \
http POST {{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore \
content-type:'multipart/form-data; boundary=---011000010111000001101001'
wget --quiet \
--method POST \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- {{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore
import Foundation
let headers = ["content-type": "multipart/form-data; boundary=---011000010111000001101001"]
let parameters = [
[
"name": "imageData",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/classify/iterations/:publishedName/image/nostore")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-06T02:15:00Z",
"id": "951098b2-9b69-427b-bddb-d5cb618874e3",
"iteration": "fe1e83c4-6f50-4899-9544-6bb08cf0e15a",
"predictions": [
{
"probability": 0.05149666,
"tagId": "e31ff107-5505-4753-be42-b369b21b026c",
"tagName": "Hemlock"
},
{
"probability": 0.000193528482,
"tagId": "349d72ac-0948-4d51-b1e4-c14a1f9b848a",
"tagName": "Japanese Cherry"
}
],
"project": "64b822c5-8082-4b36-a426-27225f4aa18c"
}
POST
Detect objects in an image and saves the result.
{{baseUrl}}/:projectId/detect/iterations/:publishedName/image
QUERY PARAMS
projectId
publishedName
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image" {:multipart [{:name "imageData"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image"
headers = HTTP::Headers{
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\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}}/:projectId/detect/iterations/:publishedName/image"),
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "imageData",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectId/detect/iterations/:publishedName/image HTTP/1.1
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 118
-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image"))
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('imageData', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('imageData', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image';
const form = new FormData();
form.append('imageData', '');
const options = {method: 'POST'};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('imageData', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image',
method: 'POST',
headers: {},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectId/detect/iterations/:publishedName/image',
headers: {
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
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('-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
formData: {imageData: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image');
req.headers({
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
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}}/:projectId/detect/iterations/:publishedName/image',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('imageData', '');
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image';
const options = {method: 'POST'};
options.body = formData;
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": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"imageData", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/detect/iterations/:publishedName/image"]
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}}/:projectId/detect/iterations/:publishedName/image" in
let headers = Header.add (Header.init ()) "content-type" "multipart/form-data; boundary=---011000010111000001101001" in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/detect/iterations/:publishedName/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/image');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/image');
$request->setRequestMethod('POST');
$request->setBody($body);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/baseUrl/:projectId/detect/iterations/:publishedName/image", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/:projectId/detect/iterations/:publishedName/image') do |req|
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image";
let form = reqwest::multipart::Form::new()
.text("imageData", "");
let mut headers = reqwest::header::HeaderMap::new();
let client = reqwest::Client::new();
let response = client.post(url)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectId/detect/iterations/:publishedName/image \
--header 'content-type: multipart/form-data' \
--form imageData=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
' | \
http POST {{baseUrl}}/:projectId/detect/iterations/:publishedName/image \
content-type:'multipart/form-data; boundary=---011000010111000001101001'
wget --quiet \
--method POST \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- {{baseUrl}}/:projectId/detect/iterations/:publishedName/image
import Foundation
let headers = ["content-type": "multipart/form-data; boundary=---011000010111000001101001"]
let parameters = [
[
"name": "imageData",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
POST
Detect objects in an image url and saves the result.
{{baseUrl}}/:projectId/detect/iterations/:publishedName/url
QUERY PARAMS
projectId
publishedName
BODY json
{
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url");
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 \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url" {:content-type :json
:form-params {:url ""}})
require "http/client"
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"url\": \"\"\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}}/:projectId/detect/iterations/:publishedName/url"),
Content = new StringContent("{\n \"url\": \"\"\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}}/:projectId/detect/iterations/:publishedName/url");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url"
payload := strings.NewReader("{\n \"url\": \"\"\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/:projectId/detect/iterations/:publishedName/url HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 15
{
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url")
.setHeader("content-type", "application/json")
.setBody("{\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"url\": \"\"\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 \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url")
.header("content-type", "application/json")
.body("{\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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}}/:projectId/detect/iterations/:publishedName/url',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url")
.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/:projectId/detect/iterations/:publishedName/url',
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({url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url',
headers: {'content-type': 'application/json'},
body: {url: ''},
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}}/:projectId/detect/iterations/:publishedName/url');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
url: ''
});
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}}/:projectId/detect/iterations/:publishedName/url',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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 = @{ @"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/detect/iterations/:publishedName/url"]
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}}/:projectId/detect/iterations/:publishedName/url" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/detect/iterations/:publishedName/url",
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([
'url' => ''
]),
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}}/:projectId/detect/iterations/:publishedName/url', [
'body' => '{
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/url');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/url');
$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}}/:projectId/detect/iterations/:publishedName/url' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"url\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectId/detect/iterations/:publishedName/url", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url"
payload = { "url": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url"
payload <- "{\n \"url\": \"\"\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}}/:projectId/detect/iterations/:publishedName/url")
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 \"url\": \"\"\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/:projectId/detect/iterations/:publishedName/url') do |req|
req.body = "{\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url";
let payload = json!({"url": ""});
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}}/:projectId/detect/iterations/:publishedName/url \
--header 'content-type: application/json' \
--data '{
"url": ""
}'
echo '{
"url": ""
}' | \
http POST {{baseUrl}}/:projectId/detect/iterations/:publishedName/url \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/:projectId/detect/iterations/:publishedName/url
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["url": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
POST
Detect objects in an image url without saving the result.
{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore
QUERY PARAMS
projectId
publishedName
BODY json
{
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore");
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 \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore" {:content-type :json
:form-params {:url ""}})
require "http/client"
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"url\": \"\"\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}}/:projectId/detect/iterations/:publishedName/url/nostore"),
Content = new StringContent("{\n \"url\": \"\"\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}}/:projectId/detect/iterations/:publishedName/url/nostore");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore"
payload := strings.NewReader("{\n \"url\": \"\"\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/:projectId/detect/iterations/:publishedName/url/nostore HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 15
{
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore")
.setHeader("content-type", "application/json")
.setBody("{\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"url\": \"\"\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 \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore")
.header("content-type", "application/json")
.body("{\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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}}/:projectId/detect/iterations/:publishedName/url/nostore',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore")
.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/:projectId/detect/iterations/:publishedName/url/nostore',
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({url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore',
headers: {'content-type': 'application/json'},
body: {url: ''},
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}}/:projectId/detect/iterations/:publishedName/url/nostore');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
url: ''
});
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}}/:projectId/detect/iterations/:publishedName/url/nostore',
headers: {'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":""}'
};
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 = @{ @"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore"]
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}}/:projectId/detect/iterations/:publishedName/url/nostore" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore",
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([
'url' => ''
]),
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}}/:projectId/detect/iterations/:publishedName/url/nostore', [
'body' => '{
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore');
$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}}/:projectId/detect/iterations/:publishedName/url/nostore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"url\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/:projectId/detect/iterations/:publishedName/url/nostore", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore"
payload = { "url": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore"
payload <- "{\n \"url\": \"\"\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}}/:projectId/detect/iterations/:publishedName/url/nostore")
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 \"url\": \"\"\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/:projectId/detect/iterations/:publishedName/url/nostore') do |req|
req.body = "{\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore";
let payload = json!({"url": ""});
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}}/:projectId/detect/iterations/:publishedName/url/nostore \
--header 'content-type: application/json' \
--data '{
"url": ""
}'
echo '{
"url": ""
}' | \
http POST {{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["url": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/detect/iterations/:publishedName/url/nostore")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
POST
Detect objects in an image without saving the result.
{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore
QUERY PARAMS
projectId
publishedName
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore" {:multipart [{:name "imageData"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore"
headers = HTTP::Headers{
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\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}}/:projectId/detect/iterations/:publishedName/image/nostore"),
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "imageData",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/:projectId/detect/iterations/:publishedName/image/nostore HTTP/1.1
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 118
-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore"))
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('imageData', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('imageData', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore';
const form = new FormData();
form.append('imageData', '');
const options = {method: 'POST'};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('imageData', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore',
method: 'POST',
headers: {},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore")
.post(body)
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/:projectId/detect/iterations/:publishedName/image/nostore',
headers: {
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
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('-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
formData: {imageData: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore');
req.headers({
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
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}}/:projectId/detect/iterations/:publishedName/image/nostore',
headers: {'content-type': 'multipart/form-data; boundary=---011000010111000001101001'},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('imageData', '');
const url = '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore';
const options = {method: 'POST'};
options.body = formData;
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": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"imageData", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore"]
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}}/:projectId/detect/iterations/:publishedName/image/nostore" in
let headers = Header.add (Header.init ()) "content-type" "multipart/form-data; boundary=---011000010111000001101001" in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore');
$request->setRequestMethod('POST');
$request->setBody($body);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/baseUrl/:projectId/detect/iterations/:publishedName/image/nostore", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {"content-type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/:projectId/detect/iterations/:publishedName/image/nostore') do |req|
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"imageData\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore";
let form = reqwest::multipart::Form::new()
.text("imageData", "");
let mut headers = reqwest::header::HeaderMap::new();
let client = reqwest::Client::new();
let response = client.post(url)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore \
--header 'content-type: multipart/form-data' \
--form imageData=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="imageData"
-----011000010111000001101001--
' | \
http POST {{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore \
content-type:'multipart/form-data; boundary=---011000010111000001101001'
wget --quiet \
--method POST \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="imageData"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- {{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore
import Foundation
let headers = ["content-type": "multipart/form-data; boundary=---011000010111000001101001"]
let parameters = [
[
"name": "imageData",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:projectId/detect/iterations/:publishedName/image/nostore")! 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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
application/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"created": "2019-03-10T06:10:28Z",
"id": "64615ba1-b53f-e911-b05b-f8633f7a2ef1",
"iteration": "45c79472-7198-46e1-8ed7-bad2ca111957",
"predictions": [
{
"boundingBox": {
"height": 0.156851858,
"left": 0.955476165,
"top": 0,
"width": 0.0412225723
},
"probability": 0.05149666,
"tagId": "7e703b80-3c7a-4c3c-bf48-9673c6891a75",
"tagName": "Tag 1"
},
{
"boundingBox": {
"height": 0.6830492,
"left": 0.062178582,
"top": 0,
"width": 0.9378114
},
"probability": 0.000193528482,
"tagId": "a0d06a54-18e4-4787-a9f9-27a9c13a91e8",
"tagName": "Tag 2"
}
],
"project": "fb5bc587-b53f-e911-b05b-f8633f7a2ef1"
}