Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
curl --request POST \
--url https://app.onecodex.com/api/v1/samples/preupload \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"metadata": {
"custom": {},
"date_collected": "2023-11-07T05:31:56Z",
"date_sequenced": "2023-11-07T05:31:56Z",
"description": "<string>",
"external_sample_id": "LIMS-2024-00123",
"location_lat": 0,
"location_lon": 0,
"location_string": "<string>",
"name": "<string>",
"starred": false
},
"project": {
"__DOLLAR_REF__": "/api/v1/projects/a1b2c3d4e5f67890"
},
"tags": []
}
'import requests
url = "https://app.onecodex.com/api/v1/samples/preupload"
payload = {
"metadata": {
"custom": {},
"date_collected": "2023-11-07T05:31:56Z",
"date_sequenced": "2023-11-07T05:31:56Z",
"description": "<string>",
"external_sample_id": "LIMS-2024-00123",
"location_lat": 0,
"location_lon": 0,
"location_string": "<string>",
"name": "<string>",
"starred": False
},
"project": { "__DOLLAR_REF__": "/api/v1/projects/a1b2c3d4e5f67890" },
"tags": []
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {
custom: {},
date_collected: '2023-11-07T05:31:56Z',
date_sequenced: '2023-11-07T05:31:56Z',
description: '<string>',
external_sample_id: 'LIMS-2024-00123',
location_lat: 0,
location_lon: 0,
location_string: '<string>',
name: '<string>',
starred: false
},
project: {__DOLLAR_REF__: '/api/v1/projects/a1b2c3d4e5f67890'},
tags: []
})
};
fetch('https://app.onecodex.com/api/v1/samples/preupload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.onecodex.com/api/v1/samples/preupload",
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([
'metadata' => [
'custom' => [
],
'date_collected' => '2023-11-07T05:31:56Z',
'date_sequenced' => '2023-11-07T05:31:56Z',
'description' => '<string>',
'external_sample_id' => 'LIMS-2024-00123',
'location_lat' => 0,
'location_lon' => 0,
'location_string' => '<string>',
'name' => '<string>',
'starred' => false
],
'project' => [
'__DOLLAR_REF__' => '/api/v1/projects/a1b2c3d4e5f67890'
],
'tags' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.onecodex.com/api/v1/samples/preupload"
payload := strings.NewReader("{\n \"metadata\": {\n \"custom\": {},\n \"date_collected\": \"2023-11-07T05:31:56Z\",\n \"date_sequenced\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"external_sample_id\": \"LIMS-2024-00123\",\n \"location_lat\": 0,\n \"location_lon\": 0,\n \"location_string\": \"<string>\",\n \"name\": \"<string>\",\n \"starred\": false\n },\n \"project\": {\n \"__DOLLAR_REF__\": \"/api/v1/projects/a1b2c3d4e5f67890\"\n },\n \"tags\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.onecodex.com/api/v1/samples/preupload")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"custom\": {},\n \"date_collected\": \"2023-11-07T05:31:56Z\",\n \"date_sequenced\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"external_sample_id\": \"LIMS-2024-00123\",\n \"location_lat\": 0,\n \"location_lon\": 0,\n \"location_string\": \"<string>\",\n \"name\": \"<string>\",\n \"starred\": false\n },\n \"project\": {\n \"__DOLLAR_REF__\": \"/api/v1/projects/a1b2c3d4e5f67890\"\n },\n \"tags\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onecodex.com/api/v1/samples/preupload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"custom\": {},\n \"date_collected\": \"2023-11-07T05:31:56Z\",\n \"date_sequenced\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"external_sample_id\": \"LIMS-2024-00123\",\n \"location_lat\": 0,\n \"location_lon\": 0,\n \"location_string\": \"<string>\",\n \"name\": \"<string>\",\n \"starred\": false\n },\n \"project\": {\n \"__DOLLAR_REF__\": \"/api/v1/projects/a1b2c3d4e5f67890\"\n },\n \"tags\": []\n}"
response = http.request(request)
puts response.read_body{
"sample_id": "<string>"
}curl --request POST \
--url https://app.onecodex.com/api/v1/samples/preupload \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"metadata": {
"custom": {},
"date_collected": "2023-11-07T05:31:56Z",
"date_sequenced": "2023-11-07T05:31:56Z",
"description": "<string>",
"external_sample_id": "LIMS-2024-00123",
"location_lat": 0,
"location_lon": 0,
"location_string": "<string>",
"name": "<string>",
"starred": false
},
"project": {
"__DOLLAR_REF__": "/api/v1/projects/a1b2c3d4e5f67890"
},
"tags": []
}
'import requests
url = "https://app.onecodex.com/api/v1/samples/preupload"
payload = {
"metadata": {
"custom": {},
"date_collected": "2023-11-07T05:31:56Z",
"date_sequenced": "2023-11-07T05:31:56Z",
"description": "<string>",
"external_sample_id": "LIMS-2024-00123",
"location_lat": 0,
"location_lon": 0,
"location_string": "<string>",
"name": "<string>",
"starred": False
},
"project": { "__DOLLAR_REF__": "/api/v1/projects/a1b2c3d4e5f67890" },
"tags": []
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {
custom: {},
date_collected: '2023-11-07T05:31:56Z',
date_sequenced: '2023-11-07T05:31:56Z',
description: '<string>',
external_sample_id: 'LIMS-2024-00123',
location_lat: 0,
location_lon: 0,
location_string: '<string>',
name: '<string>',
starred: false
},
project: {__DOLLAR_REF__: '/api/v1/projects/a1b2c3d4e5f67890'},
tags: []
})
};
fetch('https://app.onecodex.com/api/v1/samples/preupload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.onecodex.com/api/v1/samples/preupload",
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([
'metadata' => [
'custom' => [
],
'date_collected' => '2023-11-07T05:31:56Z',
'date_sequenced' => '2023-11-07T05:31:56Z',
'description' => '<string>',
'external_sample_id' => 'LIMS-2024-00123',
'location_lat' => 0,
'location_lon' => 0,
'location_string' => '<string>',
'name' => '<string>',
'starred' => false
],
'project' => [
'__DOLLAR_REF__' => '/api/v1/projects/a1b2c3d4e5f67890'
],
'tags' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.onecodex.com/api/v1/samples/preupload"
payload := strings.NewReader("{\n \"metadata\": {\n \"custom\": {},\n \"date_collected\": \"2023-11-07T05:31:56Z\",\n \"date_sequenced\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"external_sample_id\": \"LIMS-2024-00123\",\n \"location_lat\": 0,\n \"location_lon\": 0,\n \"location_string\": \"<string>\",\n \"name\": \"<string>\",\n \"starred\": false\n },\n \"project\": {\n \"__DOLLAR_REF__\": \"/api/v1/projects/a1b2c3d4e5f67890\"\n },\n \"tags\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.onecodex.com/api/v1/samples/preupload")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"custom\": {},\n \"date_collected\": \"2023-11-07T05:31:56Z\",\n \"date_sequenced\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"external_sample_id\": \"LIMS-2024-00123\",\n \"location_lat\": 0,\n \"location_lon\": 0,\n \"location_string\": \"<string>\",\n \"name\": \"<string>\",\n \"starred\": false\n },\n \"project\": {\n \"__DOLLAR_REF__\": \"/api/v1/projects/a1b2c3d4e5f67890\"\n },\n \"tags\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onecodex.com/api/v1/samples/preupload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"custom\": {},\n \"date_collected\": \"2023-11-07T05:31:56Z\",\n \"date_sequenced\": \"2023-11-07T05:31:56Z\",\n \"description\": \"<string>\",\n \"external_sample_id\": \"LIMS-2024-00123\",\n \"location_lat\": 0,\n \"location_lon\": 0,\n \"location_string\": \"<string>\",\n \"name\": \"<string>\",\n \"starred\": false\n },\n \"project\": {\n \"__DOLLAR_REF__\": \"/api/v1/projects/a1b2c3d4e5f67890\"\n },\n \"tags\": []\n}"
response = http.request(request)
puts response.read_body{
"sample_id": "<string>"
}/preupload route to receive a unique sample ID. That sample ID may be then passed when uploading your data (see Starting an Upload) to upload data for the pre-uploaded sample instead of creating a new sample.
Samples created via the /preupload route will have a visibility property with a value awaiting data. These samples and their metadata will be private, though they may be shared with other accounts if associated with a project at creation time (see Sharing & Projects for more details on sharing data via projects).OK
The sample ID. Use to confirm the upload.
