Write To A Protocol
curl --request POST \
--url https://cloudlab.scispot.io/labspace/protocol/write \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My Protocol",
"hrid": "MY_PROTOCOL",
"contentType": "text",
"contentToAppend": {
"content": "Results from Sample Manager have been recorded for SMPL000001."
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My Protocol',
hrid: 'MY_PROTOCOL',
contentType: 'text',
contentToAppend: {content: 'Results from Sample Manager have been recorded for SMPL000001.'}
})
};
fetch('https://cloudlab.scispot.io/labspace/protocol/write', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://cloudlab.scispot.io/labspace/protocol/write"
payload = {
"name": "My Protocol",
"hrid": "MY_PROTOCOL",
"contentType": "text",
"contentToAppend": { "content": "Results from Sample Manager have been recorded for SMPL000001." }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true
}{
"success": false,
"message": "Invalid Authentication Token"
}{
"success": false,
"message": "Missing Authentication Token"
}{
"success": false,
"message": "Not found"
}{
"success": false,
"message": "Conflict"
}{
"success": false,
"message": "Validation error"
}{
"success": false,
"message": "Operation failed"
}Update
Write To A Protocol
This endpoint allows users to append the contentType, using contentToAppend, replace using contentToReplace, and add to the head using contentToHeadto the protocol.
POST
https://cloudlab.scispot.io
/
labspace
/
protocol
/
write
Write To A Protocol
curl --request POST \
--url https://cloudlab.scispot.io/labspace/protocol/write \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "My Protocol",
"hrid": "MY_PROTOCOL",
"contentType": "text",
"contentToAppend": {
"content": "Results from Sample Manager have been recorded for SMPL000001."
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'My Protocol',
hrid: 'MY_PROTOCOL',
contentType: 'text',
contentToAppend: {content: 'Results from Sample Manager have been recorded for SMPL000001.'}
})
};
fetch('https://cloudlab.scispot.io/labspace/protocol/write', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://cloudlab.scispot.io/labspace/protocol/write"
payload = {
"name": "My Protocol",
"hrid": "MY_PROTOCOL",
"contentType": "text",
"contentToAppend": { "content": "Results from Sample Manager have been recorded for SMPL000001." }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true
}{
"success": false,
"message": "Invalid Authentication Token"
}{
"success": false,
"message": "Missing Authentication Token"
}{
"success": false,
"message": "Not found"
}{
"success": false,
"message": "Conflict"
}{
"success": false,
"message": "Validation error"
}{
"success": false,
"message": "Operation failed"
}If
Validation notes: provide at least one of name, hrid, uuid; provide at least one of contentToAppend, contentToReplace, contentToHead.
Provide one of name, uuid, or hrid and at least one of contentToAppend, contentToReplace, or contentToHead. contentType defaults to text and supports image and json payloads.
contentType is “image”, then the contentToAppend, contentToReplace, and/or contentToHead will need to be a JSON Object with the following properties:
- uuid: (String) The uuid of the image. This can be found using after uploading the file using the https://new.scispot.io/files/store endpoint.
- name: (String) The name of the image
contentType is “json”, then the contentToAppend, contentToReplace, and/or contentToHead will need to be a JSON Object with the following properties:
- elements: (array) This will serve as the base object. This array will contain all other elemennts that will be added into the protocol. Elements can either contain section, text, or file json objects as described below
- type: (String) The identifier of what this type this JSON object will be. Currently supports “text”, “section”, “text”
- items: (array) An array of elements that will be embedded within a section. Note nested sections are not allowed
- content: (string) The text to be added in
- headers : (string) What header to use for the text. Currently supports “h1”, “h2’, “h3”, “h4”, “h5”, “h6”. (Optional)
- bold : (boolean) Add bold formatting to the text) (Optional)
- italics : (boolean) Add italics formatting to the text (Optional)
- underline : (boolean) Add underline formatting to the text (Optional)
- strikethrough: (boolean) Add strikethroughformatting to the text (Optional)
- uuid: (String) The uuid of the file. This can be found using after uploading the file using the https://new.scispot.io/files/store endpoint.
- name: (String) The name of the file, eg. “file.csv”
- fileType: (String) The type of the file, eg. “csv”
{
"elements": [
{
"type": "section",
"items": [
{
"type": "text",
"header": "h3",
"bold": true,
"italics": true
"content": "This is the title of the section"
},
{
"type": "text",
"content": "This is the content of my section"
}
]
},
{
"type": "text",
"content": "Some text outside the section"
},
{
"type": "file",
"uuid": "e1962cf0-e905-4111-8ed2-3c1b754b1b08",
"name": "test.csv",
"fileType": "csv"
}
]
}
Authorizations
Body
application/json
⌘I
