> For the complete documentation index, see [llms.txt](https://documentation.ocsinventory-ng.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.ocsinventory-ng.org/open-api-reference/sections.md).

# Sections

## GET /sections/

> This class will define the view behavior\
> \
> Args:\
> &#x20;   viewsets (\[OCSVIewSet])

```json
{"openapi":"3.0.3","info":{"title":"OCS Inventory Backend API References","version":"3.0.0"},"security":[{"knoxApiToken":[]}],"components":{"securitySchemes":{"knoxApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"PaginatedSectionList":{"type":"object","required":["count","results"],"properties":{"count":{"type":"integer"},"next":{"type":"string","nullable":true,"format":"uri"},"previous":{"type":"string","nullable":true,"format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}}},"Section":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"retrieval_method":{"$ref":"#/components/schemas/SectionRetrievalMethodEnum"},"retrieval_output":{"$ref":"#/components/schemas/RetrievalOutputEnum"},"target":{"type":"string"},"template":{"type":"integer"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"options":{"nullable":true},"is_active":{"type":"boolean"}},"required":["fields","id","name","target"]},"SectionRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD","SNMP_WALK","SNMP_GET"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command\n* `SNMP_WALK` - Walk the SNMP tree starting from a specific OID\n* `SNMP_GET` - Get a specific OID"},"RetrievalOutputEnum":{"enum":["PTXT","JSON","TBLE","REGX","GREP"],"type":"string","description":"* `PTXT` - Plain text\n* `JSON` - JSON format\n* `TBLE` - Table format\n* `REGX` - Regex processing\n* `GREP` - Grep command output"},"Field":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"order":{"type":"integer","maximum":9223372036854776000,"minimum":-9223372036854776000,"format":"int64"},"retrieval_value":{"type":"string","nullable":true,"maxLength":255},"override_target":{"type":"boolean","nullable":true},"new_target":{"type":"string","nullable":true},"retrieval_method":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/FieldRetrievalMethodEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"retrieval_output":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/RetrievalOutputEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"section":{"type":"integer"},"options":{"nullable":true}},"required":["id","name"]},"FieldRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command"},"NullEnum":{"enum":[null]}}},"paths":{"/sections/":{"get":{"operationId":"sections_list","description":"This class will define the view behavior\n\nArgs:\n    viewsets ([OCSVIewSet])","parameters":[{"in":"query","name":"format","schema":{"type":"string","enum":["json","xml"]}},{"in":"query","name":"id","schema":{"type":"integer"}},{"in":"query","name":"is_active","schema":{"type":"boolean"}},{"name":"limit","required":false,"in":"query","description":"Number of results to return per page.","schema":{"type":"integer"}},{"in":"query","name":"name","schema":{"type":"string"}},{"name":"offset","required":false,"in":"query","description":"The initial index from which to return the results.","schema":{"type":"integer"}},{"name":"ordering","required":false,"in":"query","description":"Which field to use when ordering the results.","schema":{"type":"string"}},{"in":"query","name":"retrieval_method","schema":{"type":"string","enum":["BASH","CMD","FILE","PW","SNMP_GET","SNMP_WALK"]},"description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command\n* `SNMP_WALK` - Walk the SNMP tree starting from a specific OID\n* `SNMP_GET` - Get a specific OID"},{"in":"query","name":"retrieval_output","schema":{"type":"string","enum":["GREP","JSON","PTXT","REGX","TBLE"]},"description":"* `PTXT` - Plain text\n* `JSON` - JSON format\n* `TBLE` - Table format\n* `REGX` - Regex processing\n* `GREP` - Grep command output"},{"name":"search","required":false,"in":"query","description":"A search term.","schema":{"type":"string"}},{"in":"query","name":"target","schema":{"type":"string"}},{"in":"query","name":"template","schema":{"type":"integer"}}],"tags":["sections"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedSectionList"}},"application/xml":{"schema":{"$ref":"#/components/schemas/PaginatedSectionList"}}},"description":""}}}}}}
```

## POST /sections/

> Handle post request, suitable for single and multi creation\
> \
> Args:\
> &#x20;   request (\[dict]): can be dict or list of dicts\
> \
> Returns:\
> &#x20;   \[type]: \[description]

```json
{"openapi":"3.0.3","info":{"title":"OCS Inventory Backend API References","version":"3.0.0"},"security":[{"knoxApiToken":[]}],"components":{"securitySchemes":{"knoxApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"Section":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"retrieval_method":{"$ref":"#/components/schemas/SectionRetrievalMethodEnum"},"retrieval_output":{"$ref":"#/components/schemas/RetrievalOutputEnum"},"target":{"type":"string"},"template":{"type":"integer"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"options":{"nullable":true},"is_active":{"type":"boolean"}},"required":["fields","id","name","target"]},"SectionRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD","SNMP_WALK","SNMP_GET"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command\n* `SNMP_WALK` - Walk the SNMP tree starting from a specific OID\n* `SNMP_GET` - Get a specific OID"},"RetrievalOutputEnum":{"enum":["PTXT","JSON","TBLE","REGX","GREP"],"type":"string","description":"* `PTXT` - Plain text\n* `JSON` - JSON format\n* `TBLE` - Table format\n* `REGX` - Regex processing\n* `GREP` - Grep command output"},"Field":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"order":{"type":"integer","maximum":9223372036854776000,"minimum":-9223372036854776000,"format":"int64"},"retrieval_value":{"type":"string","nullable":true,"maxLength":255},"override_target":{"type":"boolean","nullable":true},"new_target":{"type":"string","nullable":true},"retrieval_method":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/FieldRetrievalMethodEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"retrieval_output":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/RetrievalOutputEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"section":{"type":"integer"},"options":{"nullable":true}},"required":["id","name"]},"FieldRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command"},"NullEnum":{"enum":[null]}}},"paths":{"/sections/":{"post":{"operationId":"sections_create","description":"Handle post request, suitable for single and multi creation\n\nArgs:\n    request ([dict]): can be dict or list of dicts\n\nReturns:\n    [type]: [description]","parameters":[{"in":"query","name":"format","schema":{"type":"string","enum":["json","xml"]}}],"tags":["sections"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Section"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Section"}},"application/json":{"schema":{"$ref":"#/components/schemas/Section"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Section"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Section"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Section"}}},"description":""}}}}}}
```

## GET /sections/{id}/

> This class will define the view behavior\
> \
> Args:\
> &#x20;   viewsets (\[OCSVIewSet])

```json
{"openapi":"3.0.3","info":{"title":"OCS Inventory Backend API References","version":"3.0.0"},"security":[{"knoxApiToken":[]}],"components":{"securitySchemes":{"knoxApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"Section":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"retrieval_method":{"$ref":"#/components/schemas/SectionRetrievalMethodEnum"},"retrieval_output":{"$ref":"#/components/schemas/RetrievalOutputEnum"},"target":{"type":"string"},"template":{"type":"integer"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"options":{"nullable":true},"is_active":{"type":"boolean"}},"required":["fields","id","name","target"]},"SectionRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD","SNMP_WALK","SNMP_GET"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command\n* `SNMP_WALK` - Walk the SNMP tree starting from a specific OID\n* `SNMP_GET` - Get a specific OID"},"RetrievalOutputEnum":{"enum":["PTXT","JSON","TBLE","REGX","GREP"],"type":"string","description":"* `PTXT` - Plain text\n* `JSON` - JSON format\n* `TBLE` - Table format\n* `REGX` - Regex processing\n* `GREP` - Grep command output"},"Field":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"order":{"type":"integer","maximum":9223372036854776000,"minimum":-9223372036854776000,"format":"int64"},"retrieval_value":{"type":"string","nullable":true,"maxLength":255},"override_target":{"type":"boolean","nullable":true},"new_target":{"type":"string","nullable":true},"retrieval_method":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/FieldRetrievalMethodEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"retrieval_output":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/RetrievalOutputEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"section":{"type":"integer"},"options":{"nullable":true}},"required":["id","name"]},"FieldRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command"},"NullEnum":{"enum":[null]}}},"paths":{"/sections/{id}/":{"get":{"operationId":"sections_retrieve","description":"This class will define the view behavior\n\nArgs:\n    viewsets ([OCSVIewSet])","parameters":[{"in":"query","name":"format","schema":{"type":"string","enum":["json","xml"]}},{"in":"path","name":"id","schema":{"type":"integer"},"description":"A unique integer value identifying this section.","required":true}],"tags":["sections"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Section"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Section"}}},"description":""}}}}}}
```

## PUT /sections/{id}/

> This class will define the view behavior\
> \
> Args:\
> &#x20;   viewsets (\[OCSVIewSet])

```json
{"openapi":"3.0.3","info":{"title":"OCS Inventory Backend API References","version":"3.0.0"},"security":[{"knoxApiToken":[]}],"components":{"securitySchemes":{"knoxApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"Section":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"retrieval_method":{"$ref":"#/components/schemas/SectionRetrievalMethodEnum"},"retrieval_output":{"$ref":"#/components/schemas/RetrievalOutputEnum"},"target":{"type":"string"},"template":{"type":"integer"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"options":{"nullable":true},"is_active":{"type":"boolean"}},"required":["fields","id","name","target"]},"SectionRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD","SNMP_WALK","SNMP_GET"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command\n* `SNMP_WALK` - Walk the SNMP tree starting from a specific OID\n* `SNMP_GET` - Get a specific OID"},"RetrievalOutputEnum":{"enum":["PTXT","JSON","TBLE","REGX","GREP"],"type":"string","description":"* `PTXT` - Plain text\n* `JSON` - JSON format\n* `TBLE` - Table format\n* `REGX` - Regex processing\n* `GREP` - Grep command output"},"Field":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"order":{"type":"integer","maximum":9223372036854776000,"minimum":-9223372036854776000,"format":"int64"},"retrieval_value":{"type":"string","nullable":true,"maxLength":255},"override_target":{"type":"boolean","nullable":true},"new_target":{"type":"string","nullable":true},"retrieval_method":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/FieldRetrievalMethodEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"retrieval_output":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/RetrievalOutputEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"section":{"type":"integer"},"options":{"nullable":true}},"required":["id","name"]},"FieldRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command"},"NullEnum":{"enum":[null]}}},"paths":{"/sections/{id}/":{"put":{"operationId":"sections_update","description":"This class will define the view behavior\n\nArgs:\n    viewsets ([OCSVIewSet])","parameters":[{"in":"query","name":"format","schema":{"type":"string","enum":["json","xml"]}},{"in":"path","name":"id","schema":{"type":"integer"},"description":"A unique integer value identifying this section.","required":true}],"tags":["sections"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Section"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Section"}},"application/json":{"schema":{"$ref":"#/components/schemas/Section"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Section"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Section"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Section"}}},"description":""}}}}}}
```

## DELETE /sections/{id}/

> This class will define the view behavior\
> \
> Args:\
> &#x20;   viewsets (\[OCSVIewSet])

```json
{"openapi":"3.0.3","info":{"title":"OCS Inventory Backend API References","version":"3.0.0"},"security":[{"knoxApiToken":[]}],"components":{"securitySchemes":{"knoxApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}}},"paths":{"/sections/{id}/":{"delete":{"operationId":"sections_destroy","description":"This class will define the view behavior\n\nArgs:\n    viewsets ([OCSVIewSet])","parameters":[{"in":"query","name":"format","schema":{"type":"string","enum":["json","xml"]}},{"in":"path","name":"id","schema":{"type":"integer"},"description":"A unique integer value identifying this section.","required":true}],"tags":["sections"],"responses":{"204":{"description":"No response body"}}}}}}
```

## PATCH /sections/{id}/

> This class will define the view behavior\
> \
> Args:\
> &#x20;   viewsets (\[OCSVIewSet])

```json
{"openapi":"3.0.3","info":{"title":"OCS Inventory Backend API References","version":"3.0.0"},"security":[{"knoxApiToken":[]}],"components":{"securitySchemes":{"knoxApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"PatchedSection":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"retrieval_method":{"$ref":"#/components/schemas/SectionRetrievalMethodEnum"},"retrieval_output":{"$ref":"#/components/schemas/RetrievalOutputEnum"},"target":{"type":"string"},"template":{"type":"integer"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"options":{"nullable":true},"is_active":{"type":"boolean"}}},"SectionRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD","SNMP_WALK","SNMP_GET"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command\n* `SNMP_WALK` - Walk the SNMP tree starting from a specific OID\n* `SNMP_GET` - Get a specific OID"},"RetrievalOutputEnum":{"enum":["PTXT","JSON","TBLE","REGX","GREP"],"type":"string","description":"* `PTXT` - Plain text\n* `JSON` - JSON format\n* `TBLE` - Table format\n* `REGX` - Regex processing\n* `GREP` - Grep command output"},"Field":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"order":{"type":"integer","maximum":9223372036854776000,"minimum":-9223372036854776000,"format":"int64"},"retrieval_value":{"type":"string","nullable":true,"maxLength":255},"override_target":{"type":"boolean","nullable":true},"new_target":{"type":"string","nullable":true},"retrieval_method":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/FieldRetrievalMethodEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"retrieval_output":{"nullable":true,"oneOf":[{"$ref":"#/components/schemas/RetrievalOutputEnum"},{"$ref":"#/components/schemas/NullEnum"}]},"section":{"type":"integer"},"options":{"nullable":true}},"required":["id","name"]},"FieldRetrievalMethodEnum":{"enum":["FILE","BASH","PW","CMD"],"type":"string","description":"* `FILE` - Read file\n* `BASH` - Bash command\n* `PW` - Powershell command\n* `CMD` - Cmd command"},"NullEnum":{"enum":[null]},"Section":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"retrieval_method":{"$ref":"#/components/schemas/SectionRetrievalMethodEnum"},"retrieval_output":{"$ref":"#/components/schemas/RetrievalOutputEnum"},"target":{"type":"string"},"template":{"type":"integer"},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}},"options":{"nullable":true},"is_active":{"type":"boolean"}},"required":["fields","id","name","target"]}}},"paths":{"/sections/{id}/":{"patch":{"operationId":"sections_partial_update","description":"This class will define the view behavior\n\nArgs:\n    viewsets ([OCSVIewSet])","parameters":[{"in":"query","name":"format","schema":{"type":"string","enum":["json","xml"]}},{"in":"path","name":"id","schema":{"type":"integer"},"description":"A unique integer value identifying this section.","required":true}],"tags":["sections"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/PatchedSection"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/PatchedSection"}},"application/json":{"schema":{"$ref":"#/components/schemas/PatchedSection"}},"application/xml":{"schema":{"$ref":"#/components/schemas/PatchedSection"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Section"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Section"}}},"description":""}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://documentation.ocsinventory-ng.org/open-api-reference/sections.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
