POST sequencing instances_batches_register
curl --request POST \
--url https://app.onecodex.com/api/v1/sequencing/batches/register \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"batch_name": "<string>",
"return_tracking_numbers": [
"<string>"
],
"samples": [
{
"tube_barcode": "<string>"
}
]
}
'import requests
url = "https://app.onecodex.com/api/v1/sequencing/batches/register"
payload = {
"batch_name": "<string>",
"return_tracking_numbers": ["<string>"],
"samples": [{ "tube_barcode": "<string>" }]
}
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({
batch_name: '<string>',
return_tracking_numbers: ['<string>'],
samples: [{tube_barcode: '<string>'}]
})
};
fetch('https://app.onecodex.com/api/v1/sequencing/batches/register', 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/sequencing/batches/register",
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([
'batch_name' => '<string>',
'return_tracking_numbers' => [
'<string>'
],
'samples' => [
[
'tube_barcode' => '<string>'
]
]
]),
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/sequencing/batches/register"
payload := strings.NewReader("{\n \"batch_name\": \"<string>\",\n \"return_tracking_numbers\": [\n \"<string>\"\n ],\n \"samples\": [\n {\n \"tube_barcode\": \"<string>\"\n }\n ]\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/sequencing/batches/register")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"batch_name\": \"<string>\",\n \"return_tracking_numbers\": [\n \"<string>\"\n ],\n \"samples\": [\n {\n \"tube_barcode\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onecodex.com/api/v1/sequencing/batches/register")
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 \"batch_name\": \"<string>\",\n \"return_tracking_numbers\": [\n \"<string>\"\n ],\n \"samples\": [\n {\n \"tube_barcode\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batch": {
"$uri": "/api/v1/sequencing/batches/0d77065796f8d173",
"batch_number": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"owner": {
"__DOLLAR_REF__": "/api/v1/users/a1b2c3d4e5f67890"
},
"status": "registered"
},
"samples": [
{
"sample": {
"__DOLLAR_REF__": "/api/v1/samples/a1b2c3d4e5f67890"
},
"tube_barcode": "<string>"
}
]
}Sequencing
Registering a Sequencing Batch
POST
/
api
/
v1
/
sequencing
/
batches
/
register
POST sequencing instances_batches_register
curl --request POST \
--url https://app.onecodex.com/api/v1/sequencing/batches/register \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"batch_name": "<string>",
"return_tracking_numbers": [
"<string>"
],
"samples": [
{
"tube_barcode": "<string>"
}
]
}
'import requests
url = "https://app.onecodex.com/api/v1/sequencing/batches/register"
payload = {
"batch_name": "<string>",
"return_tracking_numbers": ["<string>"],
"samples": [{ "tube_barcode": "<string>" }]
}
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({
batch_name: '<string>',
return_tracking_numbers: ['<string>'],
samples: [{tube_barcode: '<string>'}]
})
};
fetch('https://app.onecodex.com/api/v1/sequencing/batches/register', 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/sequencing/batches/register",
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([
'batch_name' => '<string>',
'return_tracking_numbers' => [
'<string>'
],
'samples' => [
[
'tube_barcode' => '<string>'
]
]
]),
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/sequencing/batches/register"
payload := strings.NewReader("{\n \"batch_name\": \"<string>\",\n \"return_tracking_numbers\": [\n \"<string>\"\n ],\n \"samples\": [\n {\n \"tube_barcode\": \"<string>\"\n }\n ]\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/sequencing/batches/register")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"batch_name\": \"<string>\",\n \"return_tracking_numbers\": [\n \"<string>\"\n ],\n \"samples\": [\n {\n \"tube_barcode\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.onecodex.com/api/v1/sequencing/batches/register")
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 \"batch_name\": \"<string>\",\n \"return_tracking_numbers\": [\n \"<string>\"\n ],\n \"samples\": [\n {\n \"tube_barcode\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"batch": {
"$uri": "/api/v1/sequencing/batches/0d77065796f8d173",
"batch_number": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"owner": {
"__DOLLAR_REF__": "/api/v1/users/a1b2c3d4e5f67890"
},
"status": "registered"
},
"samples": [
{
"sample": {
"__DOLLAR_REF__": "/api/v1/samples/a1b2c3d4e5f67890"
},
"tube_barcode": "<string>"
}
]
}You can let One Codex know about sequencing samples that are inbound to our lab by registering them as part of a Sequencing Batch. A Batch can have one or more samples associated with it, and lets you associate the tube barcodes for the Reformatting or Sample Collection tubes you have with
Sample objects in One Codex.
The response from this endpoint will give you a list of Samples, each with an identifier and the tube barcode it is associated with. You should store this identifier so that you can update Sample metadata or retrieve the Sample later on.Body
application/json
Response
200 - application/json
OK
⌘I

