ProtocolList

Protocol are linked to e.g. a Sample in the form of a ProtocolList. A Worklow can consist of one or more Protocols with a given order. ProtocolList can be created: - on-the-fly when editing a Sample or Assay and linking one or more Protocols. - can be defined as ProtocolList Templates (is_template=True) through this endpoint

Non template ProtocolList only have a autogenerated name, which displays the number of 'steps'

POST Template ProtocolList

To create a Template ProtocolList one can send a POST like the following.

{
    "results": {
        "name": {"value": {"name": "Illumina Prep ProtocolList"}},
        "is_template": {"value": true},
        "protocols": {
            "value": [{
                "id": "ANOTHERRANDOMUUID",
                "name": "A Illum Lib. Prep Protocol",
                "order": 0
            }]
        }
    }
}

PUT Template ProtocolList

To edit a pre-defined ProtocolList the following example will update the name and add another Protocol to the above example:

{
    "results": {
        "id": {"value": "RANDOMUUID"},
        "name": {"value": {"name": "Updated Illumina Prep ProtocolList"}},
        "is_template": {"value": true},
        "protocols": {
            "value": [
                {
                    "id": "ANOTHERRANDOMUUID",
                    "name": "A Illum Lib. Prep Protocol",
                    "order": 0
                },
                {
                    "id": "XXANOTHERRANDOMUUID",
                    "name": "Illum Lib. Prep Protocol Step 2",
                    "order": 1
                },
            ]
        }
    }
}
» click to learn about Filtering, Ordering and more...

Accepted filters:

- id: ID (exact)
- created: Created (exact)
- modified: Modified (exact)
- name: Name starts with (istartswith)
- description: Description contains (icontains)
- query: Search filter on the name property (exact)
- owner: Owner Username (exact)
- owned_by: Filter on list of owned by group names [OR] (exact)
- public: Public (exact)
- deleted: Deleted (exact)
- deleted_by: Deleted by (exact)
- deleted_date: Deleted date (exact)
- applied_on: [invalid name] (exact)
- is_template: Is Template (exact)
- applicable_model_types: [invalid name] (exact)
- created_by: Created by Username (exact)
- modified_by: Modified by Username (exact)

Advanced Filtering

You can also filter using a json object to process all search parameters. Currently this filter supports the syntax as produced/used by the http://summitroute.github.io/react-structured-filter/ search UI.

Example

?query_expression={"category":"name","operator":"contains","value":"Y00"},
       {"category":"amount","operator":">","value":"10"},
       {"category":"type__name","operator":"exact","value":"ANTIBODY"}
» more info about the query_expression param..

Preset mappings

- protocols: protocols__name
- applied_on: <function filter_protocol_list_by_applied_on at 0x7f43648f9510>
- deleted: <function filter_deleted at 0x7f45063b6710>
- deleted_by: deleted_by__username
- owner: owner__username
- owned_by: owned_by__name
- created_by: created_by__username
- modified_by: modified_by__username

Operators

- ==
- =
- >=
- >
- <=
- <
- contains
- icontains
- exact
- iexact
- startswith
- istartswith
- endswith
- iendswith

Permission filtering

Based on the current logged in user you can filter for objects that have a particular permission set:

- can_change: True/False, show objects that you can change
- can_delete: True/False, show objects that you can delete

# not applicable - will raise NotAcceptable:
- can_view: as this is always True, you can only view items you are allowed to see

Ordering

You can order on practically any field even spanning relations.

# reverse order on owner username
?ordering=-owner

# order on related field
?ordering=category__version
## ProtocolList

`Protocol` are linked to e.g. a `Sample` in the form of a `ProtocolList`. A `Worklow` can consist of one or more
`Protocols` with a given order.
`ProtocolList` can be created:
    - on-the-fly when editing a `Sample` or `Assay` and linking one or more `Protocols`.
    - can be defined as ProtocolList Templates (`is_template=True`) through this endpoint

Non template ProtocolList only have a autogenerated name, which displays the number of 'steps'

### POST Template ProtocolList

To create a Template `ProtocolList` one can send a POST like the following.

```
{
    "results": {
        "name": {"value": {"name": "Illumina Prep ProtocolList"}},
        "is_template": {"value": true},
        "protocols": {
            "value": [{
                "id": "ANOTHERRANDOMUUID",
                "name": "A Illum Lib. Prep Protocol",
                "order": 0
            }]
        }
    }
}
```

### PUT Template ProtocolList

To edit a pre-defined `ProtocolList` the following example will update the name and add another `Protocol`
to the above example:

```
{
    "results": {
        "id": {"value": "RANDOMUUID"},
        "name": {"value": {"name": "Updated Illumina Prep ProtocolList"}},
        "is_template": {"value": true},
        "protocols": {
            "value": [
                {
                    "id": "ANOTHERRANDOMUUID",
                    "name": "A Illum Lib. Prep Protocol",
                    "order": 0
                },
                {
                    "id": "XXANOTHERRANDOMUUID",
                    "name": "Illum Lib. Prep Protocol Step 2",
                    "order": 1
                },
            ]
        }
    }
}
```

None

The default modelviewset used in this project


Add JSONPatch like functionality to bulk update items.


### Bulk Delete

This view also allows for one to bulk delete items. The url needs to be appended by ``/bulk_delete/`` and the ids
need to be given by multiple query_params:

```
{current_url}/bulk_delete/?id=<id_1>,id=<id_2>
```
GET /api/v2/protocols/protocollists/?format=api&ordering=created_by
HTTP 200 OK
Allow: GET, POST, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "previous": null,
    "next": null,
    "current": 1,
    "total": 0,
    "total_pages": 1,
    "results": []
}