# Collection

This endpoint is used to manager collection inside an organization.

### Entity fields:

| Path                        | Type   | Description            |
| --------------------------- | ------ | ---------------------- |
| data.type                   | string | Should be "step"       |
| data.attributes.description | string | Collection description |
| data.attributes.name        | string | Collection name        |
| data.attributes.priority    | int    | Collection priority    |

### Example:

```json
POST /api/v1/organization/${ORGANIZATION_ID}/collection/

{
    "data": {
        "type": "collection",
        "attributes": {
            "description": "Sample Description",
            "name": "Collection1",
            "priority": 10,
        }
}

```

### Supported Operation

## GET /organization/{organizationId}/collection

> Returns the relationship collection

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"collection"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/collection":{"get":{"tags":["collection"],"description":"Returns the relationship collection","parameters":[{"name":"sort","in":"query","description":"Sorts the collection on the selected attributes.  A prefix of '-' sorts descending","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["createdBy","-createdBy","description","-description","name","-name","priority","-priority","updatedBy","-updatedBy","id","-id"]}}},{"name":"fields[collection]","in":"query","description":"Selects the set of collection fields that should be returned in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["createdBy","createdDate","description","name","priority","updatedBy","updatedDate","item","organization","reference"]}}},{"name":"include","in":"query","description":"Selects the set of relationships that should be expanded as a compound document in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["item","organization","reference"]}}},{"name":"filter[collection]","in":"query","description":"Filters the collection of collection using a 'disjoint' RSQL expression","schema":{"type":"string"}},{"name":"page[number]","in":"query","description":"Number of pages to return.  Can be used with page[size]","schema":{"type":"integer","format":"int32"}},{"name":"page[size]","in":"query","description":"Number of elements per page.  Can be used with page[number]","schema":{"type":"integer","format":"int32"}},{"name":"page[offset]","in":"query","description":"Offset from 0 to start paginating.  Can be used with page[limit]","schema":{"type":"integer","format":"int32"}},{"name":"page[limit]","in":"query","description":"Maximum number of items to return.  Can be used with page[offset]","schema":{"type":"integer","format":"int32"}},{"name":"page[totals]","in":"query","description":"For requesting total pages/records be included in the response page meta data","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/collection"}},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}}}}}},"components":{"schemas":{"collection":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (team manage collection)\nDelete Permissions : (team manage collection)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"createdBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"createdDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"description":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"name":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"priority":{"type":"integer","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","format":"int32","readOnly":false,"writeOnly":false},"updatedBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"updatedDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"item":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["item"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"reference":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

## POST /organization/{organizationId}/collection

> Creates an item of type collection and adds it to collection

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"collection"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/collection":{"post":{"tags":["collection"],"description":"Creates an item of type collection and adds it to collection","requestBody":{"content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/collection"},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}},"responses":{"201":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/collection"},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}}}}}},"components":{"schemas":{"collection":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (team manage collection)\nDelete Permissions : (team manage collection)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"createdBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"createdDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"description":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"name":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"priority":{"type":"integer","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","format":"int32","readOnly":false,"writeOnly":false},"updatedBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"updatedDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"item":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["item"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"reference":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

## GET /organization/{organizationId}/collection/{collectionId}

> Returns an instance of type collection

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"collection"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/collection/{collectionId}":{"get":{"tags":["collection"],"description":"Returns an instance of type collection","parameters":[{"name":"fields[collection]","in":"query","description":"Selects the set of collection fields that should be returned in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["createdBy","createdDate","description","name","priority","updatedBy","updatedDate","item","organization","reference"]}}},{"name":"include","in":"query","description":"Selects the set of relationships that should be expanded as a compound document in the result.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["item","organization","reference"]}}}],"responses":{"200":{"description":"Successful response","content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/collection"},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}}}}}},"components":{"schemas":{"collection":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (team manage collection)\nDelete Permissions : (team manage collection)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"createdBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"createdDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"description":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"name":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"priority":{"type":"integer","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","format":"int32","readOnly":false,"writeOnly":false},"updatedBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"updatedDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"item":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["item"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"reference":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```

## DELETE /organization/{organizationId}/collection/{collectionId}

> Deletes an instance of type collection

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"collection"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/collection/{collectionId}":{"delete":{"tags":["collection"],"description":"Deletes an instance of type collection","responses":{"204":{"description":"Successful response"}}}}}}
```

## PATCH /organization/{organizationId}/collection/{collectionId}

> Modifies an instance of type collection

```json
{"openapi":"3.0.1","info":{"title":"Elide Service","version":"0.0.1"},"tags":[{"name":"collection"}],"servers":[{"url":"/api/v1"}],"paths":{"/organization/{organizationId}/collection/{collectionId}":{"patch":{"tags":["collection"],"description":"Modifies an instance of type collection","requestBody":{"content":{"application/vnd.api+json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/collection"},"included":{"uniqueItems":true,"type":"array","description":"Included resources","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"type":"object"},"relationships":{"type":"object"}}}}}}}}},"responses":{"204":{"description":"Successful response"}}}}},"components":{"schemas":{"collection":{"type":"object","properties":{"type":{"type":"string","description":"Create Permissions : (team manage collection)\nDelete Permissions : (team manage collection)"},"id":{"type":"string"},"attributes":{"type":"object","properties":{"createdBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"createdDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"description":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"name":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"priority":{"type":"integer","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","format":"int32","readOnly":false,"writeOnly":false},"updatedBy":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false},"updatedDate":{"type":"string","description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}},"relationships":{"type":"object","properties":{"item":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["item"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"organization":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["organization"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}},"reference":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["reference"]},"id":{"type":"string"}},"description":"Read Permissions : (team view collection)\nUpdate Permissions : (team manage collection)","readOnly":false,"writeOnly":false}}}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.terrakube.io/api/methods/collection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
