> 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/templates.md).

# Templates

## GET /templates/

> 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":{"PaginatedTemplateList":{"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/Template"}}}},"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/":{"get":{"operationId":"templates_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":"is_protected","schema":{"type":"boolean"}},{"in":"query","name":"last_update","schema":{"type":"string","format":"date-time"}},{"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":"os","schema":{"type":"string","enum":["DEB","LEG","MAC","RHEL","SNMP","VIRT","WIN"]},"description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},{"name":"search","required":false,"in":"query","description":"A search term.","schema":{"type":"string"}}],"tags":["templates"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedTemplateList"}},"application/xml":{"schema":{"$ref":"#/components/schemas/PaginatedTemplateList"}}},"description":""}}}}}}
```

## POST /templates/

> 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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/":{"post":{"operationId":"templates_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":["templates"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Template"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Template"}},"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## GET /templates/{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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/":{"get":{"operationId":"templates_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 template.","required":true}],"tags":["templates"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## PUT /templates/{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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/":{"put":{"operationId":"templates_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 template.","required":true}],"tags":["templates"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Template"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Template"}},"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## DELETE /templates/{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":{"/templates/{id}/":{"delete":{"operationId":"templates_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 template.","required":true}],"tags":["templates"],"responses":{"204":{"description":"No response body"}}}}}}
```

## PATCH /templates/{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":{"PatchedTemplate":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}}},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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]},"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]}}},"paths":{"/templates/{id}/":{"patch":{"operationId":"templates_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 template.","required":true}],"tags":["templates"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/PatchedTemplate"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/PatchedTemplate"}},"application/json":{"schema":{"$ref":"#/components/schemas/PatchedTemplate"}},"application/xml":{"schema":{"$ref":"#/components/schemas/PatchedTemplate"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## GET /templates/{id}/export/

> Export a template and its nested sections and fields, using specific\
> serializers to strip ids and fk relations

```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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/export/":{"get":{"operationId":"templates_export_retrieve","description":"Export a template and its nested sections and fields, using specific\nserializers to strip ids and fk relations","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 template.","required":true}],"tags":["templates"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## POST /templates/{id}/import-sections/

> Import (append) one or more sections, with their nested fields, into an\
> existing template. Used by the partial template import: the sections\
> come from an exported template file and are attached as brand new\
> sections, so any provided id is dropped and the template is forced to\
> the target one.

```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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/import-sections/":{"post":{"operationId":"templates_import_sections_create","description":"Import (append) one or more sections, with their nested fields, into an\nexisting template. Used by the partial template import: the sections\ncome from an exported template file and are attached as brand new\nsections, so any provided id is dropped and the template is forced to\nthe target one.","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 template.","required":true}],"tags":["templates"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Template"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Template"}},"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## GET /templates/{id}/versions/

> List the version history for this template

```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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/versions/":{"get":{"operationId":"templates_versions_retrieve","description":"List the version history for this template","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 template.","required":true}],"tags":["templates"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## POST /templates/{id}/versions/

> List the version history for this template

```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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/versions/":{"post":{"operationId":"templates_versions_create","description":"List the version history for this template","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 template.","required":true}],"tags":["templates"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Template"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Template"}},"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## GET /templates/{id}/versions/{version\_id}/

> Retrieve a single version, including its full snapshot, or delete it

```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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/versions/{version_id}/":{"get":{"operationId":"templates_versions_retrieve_2","description":"Retrieve a single version, including its full snapshot, or delete it","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 template.","required":true},{"in":"path","name":"version_id","schema":{"type":"string"},"required":true}],"tags":["templates"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"description":""}}}}}}
```

## DELETE /templates/{id}/versions/{version\_id}/

> Retrieve a single version, including its full snapshot, or delete it

```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":{"/templates/{id}/versions/{version_id}/":{"delete":{"operationId":"templates_versions_destroy","description":"Retrieve a single version, including its full snapshot, or delete it","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 template.","required":true},{"in":"path","name":"version_id","schema":{"type":"string"},"required":true}],"tags":["templates"],"responses":{"204":{"description":"No response body"}}}}}}
```

## POST /templates/{id}/versions/{version\_id}/rollback/

> Restore the template to the state captured in a previous version.

```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":{"Template":{"type":"object","description":"This serialize class provide the API representation","properties":{"id":{"type":"integer","readOnly":true},"name":{"type":"string","maxLength":50},"os":{"$ref":"#/components/schemas/OsEnum"},"is_protected":{"type":"boolean"},"last_update":{"type":"string","format":"date-time","readOnly":true},"sections":{"type":"array","items":{"$ref":"#/components/schemas/Section"}}},"required":["id","last_update","name","sections"]},"OsEnum":{"enum":["LEG","DEB","RHEL","MAC","WIN","SNMP","VIRT"],"type":"string","description":"* `LEG` - Legacy\n* `DEB` - Linux (Debian based)\n* `RHEL` - Linux (RHEL based)\n* `MAC` - Mac\n* `WIN` - Windows\n* `SNMP` - SNMP\n* `VIRT` - Virtualization"},"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":{"/templates/{id}/versions/{version_id}/rollback/":{"post":{"operationId":"templates_versions_rollback_create","description":"Restore the template to the state captured in a previous version.","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 template.","required":true},{"in":"path","name":"version_id","schema":{"type":"string"},"required":true}],"tags":["templates"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Template"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Template"}},"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Template"}},"application/xml":{"schema":{"$ref":"#/components/schemas/Template"}}},"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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
