### User Object Example Source: https://apidoc.protocols.io/index This is an example of a full user object returned by the API. It includes details such as name, affiliation, username, and profile image information. ```json { "name": "Vladimir Frolov", "affiliation": null, "username": "vladimir-frolov10", "link": null, "image": { "source": "https://s3.amazonaws.com/pr-journal/djqbjf6.jpg", "placeholder": "https://s3.amazonaws.com/pr-journal/djqbjf6.jpg" } } ``` -------------------------------- ### Protocol Action Example - Change Description Source: https://apidoc.protocols.io/index This JSON object demonstrates a protocol action to change the description of a protocol. It includes a unique identifier (guid), the changes to be applied (up), the previous state (down), a marker indicating the type of action, and a timestamp. The 'up' field specifies the new description, while 'down' shows the old description. ```json { "guid": "28C5E0F0D96211E9A8EB9746B7AE966Ф", "up": [ { "path": ["description"], "value": "new description" } ], "down": [ { "path": ["description"], "value": "current description" } ], "marker": "draft:change-description", "microtime": 1568735122558 } ``` -------------------------------- ### Example Response for Get Workspaces List (JSON) Source: https://apidoc.protocols.io/index This JSON response shows the structure of the data returned when requesting a list of public workspaces. It includes an 'items' array containing workspace objects and a 'pagination' object for navigating through results. ```json { "items": [ { "id": 45, "uri": "verve-net", "title": "VERVE Net", "image": { "source": "https:\/\/s3.amazonaws.com\/pr-journal\/cdqcwwe.png", "placeholder": "https:\/\/s3.amazonaws.com\/pr-journal\/cdqcwwe.png" }, "is_member": 0, "description": "Welcome to the Viral Ecology Research and Virtual Exchange network (VERVE Net). This is an online forum to increase connectivity and collaboration among virus ecology researchers. Funded by the Gordon and Betty Moore Foundation." } ], "pagination": { "current_page": 0, "total_pages": 2, "total_results": 14, "next_page": "https:\/\/protocols.io\/api\/v3\/workspaces?page_size=10&page_id=1", "prev_page": null, "page_size": 10, "first": 0, "last": 14, "changed_on": null } } ``` -------------------------------- ### Get Protocol Comments API Response Example Source: https://apidoc.protocols.io/index An example of the JSON response received when fetching protocol comments via the API. It includes a list of comments, each with details like ID, author, and content, along with a status code. ```json { "comments": [ { "comment_id": 0, "discussion_id": 20706, "is_discussion": 1, "parent_id": 0, "body": "{\"blocks\":[{\"key\":\"4rcfq\",\"text\":\"step 1 discussion\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":[]}],\"entityMap\":[]}", "created_on": 1540295702, "changed_on": 0, "can_edit": 1, "can_delete": 0, "creator": { "name": "Lenny Teytelman", "affiliation": "protocols.io", "username": "lenny-teytelman", "link": null }, "step_number": 1, "step_id": 623276, "is_public": 0, "is_private": 0, "comments": [...] } ], "status_code": 0 } ``` -------------------------------- ### Small User Object Example Source: https://apidoc.protocols.io/index This is an example of a smaller user object, containing a subset of the full user details. It typically includes the name, affiliation, and username. ```json { "name": "Vladimir Frolov", "affiliation": null, "username": "vladimir-frolov10" } ``` -------------------------------- ### Get Folder IDs Response Example Source: https://apidoc.protocols.io/index Example JSON response for the 'Get folder ids' API endpoint. It contains a list of integer IDs, a pagination object, and a status code. The status code 0 indicates a successful request. ```json { "ids": [6032, 6020, 6060, 6059, 6026, 6025], "pagination": { "current_page": 1, "total_pages": 1, "total_results": 7, "next_page": null, "prev_page": null, "page_size": "50", "first": 0, "last": 7, "changed_on": null }, "status_code": 0 } ``` -------------------------------- ### Protocols API Response Example (JSON) Source: https://apidoc.protocols.io/index An example JSON response from the Protocols.io API when requesting a list of protocols. It details the structure of 'items' (individual protocols) and 'pagination' information, including current page, total pages, and navigation links. ```json { "items": [ { "id": 872, "title": "Lysis Buffer (20 mL)", "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "doi": "dx.doi.org/10.17504/protocols.io.c4gytv", "uri": "lysis-buffer-20-ml-c4gytv", "published_on": 1487372466, "created_on": 1434670606, "creator": { "name": "Celina Gomez", "affiliation": null, "username": "celina-gomez", "link": "", "image": { "source": null, "placeholder": null } }, "public": 1, "versions": [ { "id": 10091, "title": "untitled protocol", "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "doi": null, "uri": "untitled-protocol-m4jc8un", "published_on": 0, "version_id": 1, "created_on": 1518089537, "creator": { "name": "Vladimir Frolov", "affiliation": "protocols.io", "username": "vladimir-frolov10", "link": null, "image": { "source": "https://s3.amazonaws.com/pr-journal/djqbjf6.jpg", "placeholder": "https://s3.amazonaws.com/pr-journal/djqbjf6.jpg" } } } ], "version_id": 0, "link": "", "number_of_steps": 3, "authors": [ { "name": "Matt Sullivan Lab", "affiliation": "Matt Sullivan Lab", "username": null, "link": null, "image": { "source": null, "placeholder": null } } ] } ], "pagination": { "current_page": 0, "total_pages": 2, "total_results": 14, "next_page": "https://protocols.io/api/v3/researchers/vladimir-frolov20/protocols?page_size=10&page_id=1", "prev_page": null, "page_size": 10, "first": 0, "last": 14, "changed_on": null } } ``` -------------------------------- ### Get Top Folders API Response (JSON) Source: https://apidoc.protocols.io/index This is an example JSON response from the 'Get top folders' API endpoint. It contains a list of folder objects, each with detailed access permissions and metadata. ```json { "folders": [ { "item_id": 6017, "content_type_id": 10, "kind": null, "access": { "can_view": 1, "can_remove": 0, "can_add": 1, "can_edit": 0, "can_publish": 0, "can_get_doi": 0, "can_share": 0, "can_move": 0, "can_transfer": 0, "can_download": 1, "is_locked": 0, "can_upload": 1, "can_edit_space": 0 }, "icon": { "name": "/img/folders/MyFiles.svg", "type": "svg", "source": "/img/folders/MyFiles.svg", "code": "MyFiles" }, "id": 492911, "title": "My files", "guid": "BA565B15A9FE423ABC933ADB41847B62", "parent_guid": null, "type_id": 2, "parent_type_id": 0, "created_on": 1542634693, "visibility": 1 } ], "status_code": 0 } ``` -------------------------------- ### Get Items by IDs Response Example Source: https://apidoc.protocols.io/index Example JSON response for the 'Get items by ids' API endpoint. It includes an 'items' array containing detailed objects for each retrieved file manager item, along with a status code. The status code 0 signifies a successful operation. ```json { "items": [ { "item_id": 6017, "content_type_id": 10, "kind": "Folder", "access": { "can_view": 1, "can_remove": 0, "can_add": 1, "can_edit": 0, "can_publish": 0, "can_get_doi": 0, "can_share": 0, "can_move": 0, "can_transfer": 0, "can_download": 1, "is_locked": 0, "can_upload": 1, "can_edit_space": 0 }, "icon": { "type": "svg", "source": "/img/folders/MyFiles.svg" }, "id": 492911, "title": "My files", "guid": "BA565B15A9FE423ABC933ADB41847B62", "parent_guid": "7E8474892766430DA73DF923F6819CAD", "type_id": 9, "parent_type_id": 6, "created_on": 1542634693 }, { "content_type_id": 1, "kind": "Private Protocol", "access": { "can_view": 1, "can_remove": 1, "can_add": 1, "can_edit": 1, "can_publish": 1, "can_get_doi": 1, "can_share": 1, "can_move": 1, "can_transfer": 1, "can_download": 1, "is_locked": 0, "can_edit_space": 0 }, "icon": { "type": "svg", "source": "/img/folders/PrivateProtocol.svg" }, "id": 872, "title": "Lysis Buffer (20 mL)", "title_html": "Lysis Buffer (20 mL)", "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "doi": "dx.doi.org/10.17504/protocols.io.c4gytv", "uri": "lysis-buffer-20-ml-c4gytv", "published_on": 1487372466, "created_on": 1434670606, "creator": { "name": "Celina Gomez", "affiliation": null, "username": "celina-gomez", "link": "", "image": { "source": null, "placeholder": null } }, "public": 1, "versions": [ { "id": 10091, "title": "untitled protocol", "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "version_id": 1, "doi": null, "uri": "untitled-protocol-m4jc8un", "published_on": 0 } ], "version_id": 0, "link": "", "number_of_steps": 3, "authors": [ { "name": "Matt Sullivan Lab", "affiliation": "Matt Sullivan Lab", "username": null, "link": null, "image": { "source": null, "placeholder": null } } ] } ], "status_code": 0 } ``` -------------------------------- ### Protocols.io API Authentication Header Example Source: https://apidoc.protocols.io/index This example demonstrates the required 'Authorization' header format for making authenticated requests to the Protocols.io API using a Bearer access token. The token can be either a CLIENT_ACCESS_TOKEN or an OAUTH_ACCESS_TOKEN. ```http Authentication: Bearer b2e9570895ae57efdc495e1ac27feb12e856aec9f354bb12aa0ceaa3b761f11a ``` -------------------------------- ### Retrieve Protocol PDF using cURL Source: https://apidoc.protocols.io/index This example shows how to download a protocol in PDF format using cURL. An Authorization header with a Bearer token is required. The '[id]' in the URL should be replaced with the protocol's ID or URI. Optional GET parameters can be used to customize the PDF output. ```shell curl https://www.protocols.io/view/[id].pdf -H "Authorization: Bearer ACCESS_TOKEN" ``` -------------------------------- ### Record Stack Notes Object Example Source: https://apidoc.protocols.io/index An example of a record stack object of type 'notes'. This object is used to manage notes associated with a record or a specific step within a record. ```json { "type": "notes", "data": { "id": 775, "note": "test1234", "step_id": 0 } } ``` -------------------------------- ### Add Protocol Comment API Response Example Source: https://apidoc.protocols.io/index An example of the JSON response returned after successfully adding a protocol comment via the API. It includes details of the newly created comment and a status code indicating success. ```json { "comment": { "comment_id": 3488, "discussion_id": 20697, "is_discussion": 0, "parent_id": 0, "body": "{\"blocks\":[{\"key\":\"a83f3\",\"text\":\"Text of a comment\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":[]}],\"entityMap\":[]}", "created_on": 1540208010, "changed_on": 0, "can_edit": 1, "can_delete": 1, "creator": { "name": "Lenny Teytelman", "affiliation": "protocols.io", "username": "lenny-teytelman", "link": null }, "step_id": 0, "is_private": 0, "comments": null }, "status_code": 0 } ``` -------------------------------- ### Record Object Structure Example Source: https://apidoc.protocols.io/index This JSON object represents a record, likely a scientific protocol or experiment. It includes metadata such as ID, GUID, titles, timestamps, creator details, location, and a list of steps. Each step contains its own detailed information, including content and status. ```json { "id": 1, "guid": "4E47E83EC1CD11EEA5EB8A0FA45ECEF7", "title": "Lorem Ipsum is simply dummy text of the printing and typesetting industry.", "title_html": "
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
", "item_id": 100, "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "created_on": 1706879802, "changed_on": 1706879802, "total_steps": 10, "finished_steps": 5, "scale_multiplier": 1.0, "creator": { "name": "John Doe", "affiliation": "University of California", "username": "johndoe", "link": "https://exmaple.com/johndoe", "image": { "source": "/img/avatars/012.png", "placeholder": "/img/avatars/012.png" } }, "location": [ { "id": 1, "guid": "63DAC23AA40811EE86F68A0FA45ECEF6", "title": "Parent folder", "type_id": 0, "created_on": 1703606643, "content_type_id": 10 }, { "id": 2, "guid": "5D28141AA40811EE86F68A0FA45ECEF6", "title": "Parent folder 2", "type_id": 0, "created_on": 1703606632, "content_type_id": 10 } ], "steps": [ { "id": 16, "guid": "4E4DAEFEC1CD11EEA5EB8A0FA45ECEF7", "previous_id": 0, "previous_guid": null, "cases": [], "step": "{\"blocks\":[{\"key\":\"5jdtn\",\"text\":\"Step 1\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}},{\"key\":\"9k2a3\",\"text\":\" \",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[{\"key\":0,\"offset\":0,\"length\":1}],\"data\":{}},{\"key\":\"95lpo\",\"text\":\"\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}}],\"entityMap\":{\"0\":{\"type\":\"amount\",\"mutability\":\"MUTABLE\",\"data\":{\"amount\":\"\",\"error\":false,\"guid\":\"\",\"id\":0,\"label\":\"\",\"scientificNotation\":false,\"unit\":1}}}}", "section": "", "section_color": "", "is_checked": 0, "checked_on": null, "is_skipped": 0, "skippedn_on": null }, { "id": 17, "guid": "4E4DAF1CC1CD11EEA5EB8A0FA45ECEF7", "previous_id": 0, "previous_guid": "4E4DAEFEC1CD11EEA5EB8A0FA45ECEF7", "cases": [], "step": "{\"blocks\":[{\"key\":\"3c6a1\",\"text\":\"Step 2\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}},{\"key\":\"dv2v9\",\"text\":\" \",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[{\"key\":0,\"offset\":0,\"length\":1}],\"data\":{}},{\"key\":\"678m3\",\"text\":\"\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}}],\"entityMap\":{\"0\":{\"type\":\"duration\",\"mutability\":\"MUTABLE\",\"data\":{\"duration\":0,\"guid\":\"\",\"id\":0,\"label\":\"\",\"pause\":0,\"preset\":[],\"start\":0}}}}", "section": "", "section_color": "", "is_checked": 0, "checked_on": null, "is_skipped": 0, "skippedn_on": null } ] } ``` -------------------------------- ### JSON Draft Object Examples Source: https://apidoc.protocols.io/index Examples of JSON structures representing various draft objects used within the Protocols.io API. These include structures for expected results, safety information, go to previous step, temperature, concentration, and notes. ```json { "blocks": [ { "key": "eaj3k", "text": "Expected results", "type": "unstyled", "depth": 0, "inlineStyleRanges": [], "entityRanges": [], "data": [] } ], "entityMap": [] } ``` ```json { "blocks": [ { "key": "87aiq", "text": "Safety information", "type": "unstyled", "depth": 0, "inlineStyleRanges": [], "entityRanges": [], "data": [] } ], "entityMap": [] } ``` ```json { "title": "Reason for repeating the step", "step_guid": "E70FDFE632504ADFB0ED519ABB5449B1" } ``` ```json { "temperature": 12, "unit": "°C", "label": "boil" } ``` ```json { "concentration": 12, "unit": "°C", "label": "boil" } ``` ```json { "blocks": [ { "key": "d8ihj", "text": "Note", "type": "unstyled", "depth": 0, "inlineStyleRanges": [], "entityRanges": [], "data": [] } ], "entityMap": [] } ``` -------------------------------- ### Create or Update Protocol Steps (curl) Source: https://apidoc.protocols.io/index Creates or updates steps within a protocol, managing their sequence using GUIDs. This method is crucial for maintaining the correct order of steps, especially when adding or modifying them. It requires an access token and a JSON payload specifying the steps, their GUIDs, and their preceding step's GUID. ```curl curl https://www.protocols.io/api/v4/protocols/[id]/steps \ -H "Authorization: Bearer ACCESS_TOKEN" \ -X POST \ -H "Content-Type: application/json" \ --data '{"steps":[{...}, {...}]}' ``` -------------------------------- ### Create or Update Protocol Steps Source: https://apidoc.protocols.io/index Creates or updates private protocol steps, managing their sequence using GUIDs. ```APIDOC ## Create or Update protocol steps ### Description This method creates or updates private protocol steps. Since steps in the protocol can be moved, and new steps can be added in the middle of an existing list, it is necessary to control their sequence. To establish the sequence of steps, two fields are used: **guid** and **previous_guid**. When you send steps for addition or modification, you need to specify the correct **previous_guid** for the steps you want to add or modify, as well as for the steps that may be affected by your changes. For example, if there are already 3 steps in the protocol and you want to add a new step between step 1 and step 2, then you need to send two steps to the API: the new step you want to add (in this step, you need to specify **previous_guid** as the **guid** of step 1), and step number 2 with **previous_guid** as the **guid** of the newly added step. This way, the sequence of steps will not be disrupted. The API validates the sequence of steps and, if an inconsistency is detected, an appropriate error will be returned. The first step in the protocol has **previous_guid** equal to **null**, and there cannot be more than one such step. ### Method POST ### Endpoint `https://www.protocols.io/api/v4/protocols/[id]/steps` ### Parameters #### Path Parameters - **id** (int or string) - Required - One of the following: 1. Integer protocol id 2. String protocol **URI** e.g. _**tree-mapping-for-leaf-collection-megantic-only-baaciaaw**_ 3. String protocol **GUID** #### Header Parameters - **Authorization** (string) - Required - Bearer **ACCESS_TOKEN**. - **Content-Type** (string) - Required - application/json #### Request Body - **steps** (array) - Required - Array of steps to update. Only steps to add or modify should be sent. - **step object** - **guid** (string) - Required - Unique step GUID. - **previous_guid** (string) - Required, can be null - GUID of the previous step in the steps sequence (null for the first step). - **step** (string) - Required (plain text) - Step content. - **section** (string) - Optional, can be null - Step section name. - **section_color** (string) - Optional, can be null - Step section color (HEX code). - **is_substep** (boolean) - Optional, can be null - True if the step is a substep. ### Request Example ```json { "steps": [ { "guid": "step-guid-1", "previous_guid": null, "step": "This is the first step.", "section": "Introduction" }, { "guid": "step-guid-2", "previous_guid": "step-guid-1", "step": "This is the second step." } ] } ``` ### Response #### Success Response (200) - **status_code** (int) - Status code of request, `0` means OK. - **status_text** (string) - Status text e.g. explanation of the error. #### Response Example ```json { "status_code": 0, "status_text": "Steps updated successfully." } ``` ### Errors list - **status code** **status text** - `400` - invalid protocol uri - `400` - invalid request body, must be a valid json - `400` - updating protocol steps with step cases is not supported - `400` - loop detected in the steps - `400` - steps are not forming a complete sequence - `400` - multiple first steps found - `400` - no first step found - `401` - you don't have access to edit this protocol - `404` - protocol does not exist - `404` - protocol was deleted for some reason (e.g. retracted) - `1218` - Authorization token is not correct ``` -------------------------------- ### Record Stack Step Object Example Source: https://apidoc.protocols.io/index An example of a record stack object of type 'step'. This object is used to modify the status of individual steps within a record, such as marking them as checked or skipped. ```json { "type": "step", "data": { "guid": "EAA54C8AFDCD4D51AFFF12DF9C76F332", "is_checked": 1 } } ``` -------------------------------- ### Full Protocol Object Example Source: https://apidoc.protocols.io/index The comprehensive representation of a protocol, including all details such as creator, authors, versions, materials, and statistics. This object provides the complete information for a specific protocol. ```json { "id": 872, "title": "Lysis Buffer (20 mL)", "title_html": "Lysis Buffer (20 mL)", "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "doi": "dx.doi.org/10.17504/protocols.io.c4gytv", "uri": "lysis-buffer-20-ml-c4gytv", "published_on": 1487372466, "created_on": 1434670606, "creator": { "name": "Celina Gomez", "affiliation": null, "username": "celina-gomez", "link": "", "image": { "source": null, "placeholder": null } }, "public": true, "versions": [ { "id": 10091, "title": "untitled protocol", "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "version_id": 1, "doi": null, "uri": "untitled-protocol-m4jc8un", "published_on": 0 } ], "version_id": 0, "link": "", "authors": [ { "name": "Matt Sullivan Lab", "affiliation": "Matt Sullivan Lab", "username": null, "link": null, "image": { "source": null, "placeholder": null } } ], "guid": "6D11D26701CA4EBAA5CA56859CCA8AC3", "materials": [...], "documents": [...], "units": [...], "funders:": [...] } ``` -------------------------------- ### Small Protocol Object Example Source: https://apidoc.protocols.io/index An intermediate representation of a protocol, expanding on the Tiny Protocol by adding versioning, DOI, and publication details. Useful for scenarios requiring more context than a simple preview. ```json { "id": 8503, "title": "Gene calling with Prodigal", "title_html": "Gene calling with Prodigal", "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "version_id": 0, "doi": "dx.doi.org/10.17504/protocols.io.kixcufn", "uri": "gene-calling-with-prodigal-kixcufn", "published_on": 1509493090 } ``` -------------------------------- ### Get Record by GUID Source: https://apidoc.protocols.io/index Fetches a record using its unique GUID. Supports retrieving associated protocol data and draft format. Requires an Authorization header with a Bearer token. The `with_protocol` and `as_draft` parameters control the response format. ```curl curl "https://www.protocols.io/api/v3/records/Record protocol
", "units": [...], "uri": "record-protocol-b9xr7m", "url": "http://localhost:900/view/record-protocol-b9xr7m", "version_id": 0, "versions": [...], "warning": "Safety" }, "record": { "id": 6, "guid": "4E47E83EC1CD11EEA5EB8A0FA45ECEF7", "title": "Record protocol", "title_html": "Record protocol", "item_id": 141, "image": { "source": "https://www.protocols.io/img/default_protocol.png", "placeholder": "https://www.protocols.io/img/default_protocol.png" }, "created_on": 1706879802, "changed_on": 1706879802, "total_steps": 2, "finished_steps": 0, "scale_multiplier": 1, "creator": { "name": "recod", "affiliation": null, "username": "m4", "link": null, "image": { "source": "/img/avatars/012.png", "placeholder": "/img/avatars/012.png" } }, "location": [...], "steps": [...] } }, "status_code": 0 } ``` ``` -------------------------------- ### Curl Command for Fetching Publications with Compression Source: https://apidoc.protocols.io/index This example demonstrates how to use curl to fetch the latest publications from the Protocols.io API. It includes the necessary 'Authorization' header and utilizes the '--compressed' flag to ensure uncompressed text output, which is particularly useful for Mac users. ```bash curl "https://www.protocols.io/api/v3/publications?latest=1" -H "Authorization: CLIENT_ACCESS_TOKEN" --compressed ``` -------------------------------- ### GET /api/v3/folders/