# EnvironmentVariables

## GET /api/v1/environment-variables

> List Environment Variables

```json
{"openapi":"3.0.1","info":{"title":"Frends API","version":"1.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Enter your bearer token in the format **Bearer &lt;token>**","name":"Authorization","in":"header"}},"schemas":{"DtoEnvironmentVariableSchemaGetPagedResponse":{"required":["Data","Paging"],"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/DtoEnvironmentVariableSchemaGet"},"description":"Response data"},"paging":{"$ref":"#/components/schemas/PagingModel"}},"additionalProperties":false},"DtoEnvironmentVariableSchemaGet":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/EnvironmentVariableType"},"values":{"type":"array","items":{"$ref":"#/components/schemas/DtoEnvironmentVariableValue"},"nullable":true},"description":{},"childSchemas":{"type":"array","items":{"$ref":"#/components/schemas/DtoEnvironmentVariableSchemaBase"}}},"additionalProperties":false},"EnvironmentVariableType":{"enum":["String","Object","Array","Secret","Number","Boolean"],"type":"string"},"DtoEnvironmentVariableValue":{"type":"object","properties":{"value":{"type":"array","items":{"$ref":"#/components/schemas/JToken"}},"modifiedUtc":{"type":"string","format":"date-time"},"modifier":{"type":"string"},"version":{"type":"integer","format":"int32"},"environment":{"$ref":"#/components/schemas/DtoEnvironmentBase"}},"additionalProperties":false},"JToken":{"type":"array","items":{"$ref":"#/components/schemas/JToken"}},"DtoEnvironmentBase":{"required":["DisplayName","Id"],"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the Environment","format":"int64","readOnly":true},"displayName":{"type":"string","description":"Display name for the Environment","readOnly":true}},"additionalProperties":false},"DtoEnvironmentVariableSchemaBase":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/EnvironmentVariableType"},"values":{"type":"array","items":{"$ref":"#/components/schemas/DtoEnvironmentVariableValue"},"nullable":true}},"additionalProperties":false},"PagingModel":{"required":["CurrentPage","FirstPage","LastPage","PageSize","TotalCount"],"type":"object","properties":{"currentPage":{"type":"integer","description":"Current page","format":"int32"},"pageSize":{"type":"integer","description":"Number of entries per page","format":"int32"},"totalCount":{"type":"integer","description":"Total number of entries","format":"int32"},"firstPage":{"type":"string","description":"Url of the first page","format":"uri","nullable":true},"lastPage":{"type":"string","description":"Url of the last page","format":"uri","nullable":true},"nextPage":{"type":"string","description":"Url of the next page","format":"uri","nullable":true},"previousPage":{"type":"string","description":"Url of the previous page","format":"uri","nullable":true}},"additionalProperties":false}}},"paths":{"/api/v1/environment-variables":{"get":{"tags":["EnvironmentVariables"],"summary":"List Environment Variables","operationId":"GetEnvironmentVariables","parameters":[{"name":"PageNumber","in":"query","description":"Current page number. Default value is 1.","schema":{"type":"integer","format":"int32"}},{"name":"PageSize","in":"query","description":"Maximum page size is 200. Default page size is 30.","schema":{"type":"integer","format":"int32"}},{"name":"environmentVariableName","in":"query","description":"Name of the Environment Variable(s)","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DtoEnvironmentVariableSchemaGetPagedResponse"}}}}}}}}}
```

## POST /api/v1/environment-variables

> Add Environment Variable

```json
{"openapi":"3.0.1","info":{"title":"Frends API","version":"1.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Enter your bearer token in the format **Bearer &lt;token>**","name":"Authorization","in":"header"}},"schemas":{"DtoRootSchemaCreate":{"required":["Name"],"type":"object","properties":{"name":{"type":"string"}},"additionalProperties":false}}},"paths":{"/api/v1/environment-variables":{"post":{"tags":["EnvironmentVariables"],"summary":"Add Environment Variable","requestBody":{"description":"Type of schema to be created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DtoRootSchemaCreate"}}}},"responses":{"201":{"description":"Successful request","headers":{"Location":{"description":"Details the created Environment Variable group.","schema":{"type":"string"}}},"content":{"text/plain":{"schema":{"type":"integer","format":"int64"}},"application/json":{"schema":{"type":"integer","format":"int64"}},"text/json":{"schema":{"type":"integer","format":"int64"}}}}}}}}}
```

## GET /api/v1/environment-variables/{id}

> Get an Environment Variable

```json
{"openapi":"3.0.1","info":{"title":"Frends API","version":"1.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Enter your bearer token in the format **Bearer &lt;token>**","name":"Authorization","in":"header"}},"schemas":{"DtoEnvironmentVariableSchemaGetResponse":{"required":["Data"],"type":"object","properties":{"data":{"$ref":"#/components/schemas/DtoEnvironmentVariableSchemaGet"}},"additionalProperties":false},"DtoEnvironmentVariableSchemaGet":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/EnvironmentVariableType"},"values":{"type":"array","items":{"$ref":"#/components/schemas/DtoEnvironmentVariableValue"},"nullable":true},"description":{},"childSchemas":{"type":"array","items":{"$ref":"#/components/schemas/DtoEnvironmentVariableSchemaBase"}}},"additionalProperties":false},"EnvironmentVariableType":{"enum":["String","Object","Array","Secret","Number","Boolean"],"type":"string"},"DtoEnvironmentVariableValue":{"type":"object","properties":{"value":{"type":"array","items":{"$ref":"#/components/schemas/JToken"}},"modifiedUtc":{"type":"string","format":"date-time"},"modifier":{"type":"string"},"version":{"type":"integer","format":"int32"},"environment":{"$ref":"#/components/schemas/DtoEnvironmentBase"}},"additionalProperties":false},"JToken":{"type":"array","items":{"$ref":"#/components/schemas/JToken"}},"DtoEnvironmentBase":{"required":["DisplayName","Id"],"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier for the Environment","format":"int64","readOnly":true},"displayName":{"type":"string","description":"Display name for the Environment","readOnly":true}},"additionalProperties":false},"DtoEnvironmentVariableSchemaBase":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/EnvironmentVariableType"},"values":{"type":"array","items":{"$ref":"#/components/schemas/DtoEnvironmentVariableValue"},"nullable":true}},"additionalProperties":false},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}},"paths":{"/api/v1/environment-variables/{id}":{"get":{"tags":["EnvironmentVariables"],"summary":"Get an Environment Variable","operationId":"GetEnvironmentVariable","parameters":[{"name":"id","in":"path","description":"Id of the Environment Variable","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Successful request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DtoEnvironmentVariableSchemaGetResponse"}}}},"404":{"description":"Environment Variable not found","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}}}
```

## POST /api/v1/environment-variables/{rootSchemaId}

> Create child Environment Variable

```json
{"openapi":"3.0.1","info":{"title":"Frends API","version":"1.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Enter your bearer token in the format **Bearer &lt;token>**","name":"Authorization","in":"header"}},"schemas":{"DtoChildSchemaCreate":{"required":["Type"],"type":"object","properties":{"name":{"type":"string"},"type":{"$ref":"#/components/schemas/EnvironmentVariableChildType"}},"additionalProperties":false},"EnvironmentVariableChildType":{"enum":["String","Array","Secret","Number","Boolean"],"type":"string"},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}},"paths":{"/api/v1/environment-variables/{rootSchemaId}":{"post":{"tags":["EnvironmentVariables"],"summary":"Create child Environment Variable","parameters":[{"name":"rootSchemaId","in":"path","description":"Id of the parent Environment Variable schema.","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"description":"Type of the child Environment Variable to be created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DtoChildSchemaCreate"}}}},"responses":{"201":{"description":"Child Environment Variable created successfully.","headers":{"Location":{"description":"Details of the created Environment Variable.","schema":{"type":"string"}}},"content":{"text/plain":{"schema":{"type":"integer","format":"int64"}}}},"400":{"description":"The provided schema id was not for a root Environment Variable schema.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}}}
```

## DELETE /api/v1/environment-variables/{schemaId}

> Delete Environment Variable

```json
{"openapi":"3.0.1","info":{"title":"Frends API","version":"1.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Enter your bearer token in the format **Bearer &lt;token>**","name":"Authorization","in":"header"}},"schemas":{"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}},"paths":{"/api/v1/environment-variables/{schemaId}":{"delete":{"tags":["EnvironmentVariables"],"summary":"Delete Environment Variable","parameters":[{"name":"schemaId","in":"path","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"204":{"description":"Environment Variable deleted successfully."},"404":{"description":"Environment Variable not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Can not delete Environment Variable in use.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}}}
```

## PATCH /api/v1/environment-variables/{schemaId}

> Update the description of an Environment Variable.

```json
{"openapi":"3.0.1","info":{"title":"Frends API","version":"1.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Enter your bearer token in the format **Bearer &lt;token>**","name":"Authorization","in":"header"}},"schemas":{"DtoEnvironmentVariableDescriptionUpdate":{"required":["Description"],"type":"object","properties":{"description":{"minLength":1,"type":"string"}},"additionalProperties":false,"description":"New description."},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}},"paths":{"/api/v1/environment-variables/{schemaId}":{"patch":{"tags":["EnvironmentVariables"],"summary":"Update the description of an Environment Variable.","parameters":[{"name":"schemaId","in":"path","description":"Identifier of the Environment Variable being updated.","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"description":"New description for the Environment Variable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DtoEnvironmentVariableDescriptionUpdate"}}}},"responses":{"204":{"description":"Environment Variable description updated successfully."},"400":{"description":"The provided description was not valid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Environment Variable not found.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}}}
```

## PUT /api/v1/environment-variables/{schemaId}/values/{environmentId}

> Update Environment Variable

```json
{"openapi":"3.0.1","info":{"title":"Frends API","version":"1.0"},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Enter your bearer token in the format **Bearer &lt;token>**","name":"Authorization","in":"header"}},"schemas":{"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}}}},"paths":{"/api/v1/environment-variables/{schemaId}/values/{environmentId}":{"put":{"tags":["EnvironmentVariables"],"summary":"Update Environment Variable","parameters":[{"name":"schemaId","in":"path","description":"Identifier of the Environment Variable being updated.","required":true,"schema":{"type":"integer","format":"int64"}},{"name":"environmentId","in":"path","description":"Identifier of the Environment being updated.","required":true,"schema":{"type":"integer","format":"int64"}}],"requestBody":{"description":"New value for the Environment Variable. The value type depends on the type of the Environment Variable schema.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}}}}},"responses":{"204":{"description":"Environment Variable updated successfully."},"400":{"description":"The provided value was not valid.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Environment or Environment Variable not found."},"409":{"description":"Conflict in the requested change.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}}}
```
