# Resources

## Create, edit, and configure multiple resources.

> The /apply route will try to parse resources\
> and upsert them into the store.

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/apply":{"post":{"description":"The /apply route will try to parse resources\nand upsert them into the store.","tags":["resources"],"summary":"Create, edit, and configure multiple resources.","responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ApplyResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ApplyPayload"}}},"description":"Resources","required":true}}}},"components":{"schemas":{"model.ApplyResponse":{"type":"object","properties":{"updates":{"type":"array","items":{"$ref":"#/components/schemas/model.ResourceStatus"}}}},"model.ResourceStatus":{"type":"object","properties":{"before":{"description":"Before is the resource before the update, currently only used for audit events and omitted from API responses"},"reason":{"description":"Reason will be set if status is invalid or error","type":"string"},"resource":{"description":"Resource is the resource that was updated"},"status":{"description":"Status is the status of the resource after the update","allOf":[{"$ref":"#/components/schemas/model.UpdateStatus"}]}}},"model.UpdateStatus":{"type":"string","enum":["unchanged","configured","created","deleted","not-found","invalid","error","in-use","forbidden","deprecated"]},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}},"model.ApplyPayload":{"type":"object","properties":{"resources":{"type":"array","items":{"$ref":"#/components/schemas/model.AnyResource"}}}},"model.AnyResource":{"type":"object"}}}}
```

## Delete multiple resources

> /delete endpoint will try to parse resources\
> and delete them from the store.

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/delete":{"post":{"description":"/delete endpoint will try to parse resources\nand delete them from the store.","tags":["resources"],"summary":"Delete multiple resources","responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.DeleteResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/model.DeletePayload"}}}},"description":"Resources","required":true}}}},"components":{"schemas":{"model.DeleteResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}},"updates":{"type":"array","items":{"$ref":"#/components/schemas/model.ResourceStatus"}}}},"model.ResourceStatus":{"type":"object","properties":{"before":{"description":"Before is the resource before the update, currently only used for audit events and omitted from API responses"},"reason":{"description":"Reason will be set if status is invalid or error","type":"string"},"resource":{"description":"Resource is the resource that was updated"},"status":{"description":"Status is the status of the resource after the update","allOf":[{"$ref":"#/components/schemas/model.UpdateStatus"}]}}},"model.UpdateStatus":{"type":"string","enum":["unchanged","configured","created","deleted","not-found","invalid","error","in-use","forbidden","deprecated"]},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}},"model.DeletePayload":{"type":"object"}}}}
```

## GET /resources/{kind}

> List resources by kind

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/resources/{kind}":{"get":{"tags":["resources"],"summary":"List resources by kind","parameters":[{"schema":{"type":"string"},"description":"the kind of the resource","name":"kind","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ResourcesResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}}}}},"components":{"schemas":{"model.ResourcesResponse":{"type":"object","properties":{"resources":{"type":"array","items":{}}}},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}
```

## GET /resources/{kind}/{name}

> Get a resource by kind and name

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/resources/{kind}/{name}":{"get":{"tags":["resources"],"summary":"Get a resource by kind and name","parameters":[{"schema":{"type":"string"},"description":"the kind of the resource","name":"kind","in":"path","required":true},{"schema":{"type":"string"},"description":"the name of the resource","name":"name","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ResourceResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}}}}},"components":{"schemas":{"model.ResourceResponse":{"type":"object","properties":{"resource":{}}},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}
```

## DELETE /resources/{kind}/{name}

> Delete a resource by kind and name

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/resources/{kind}/{name}":{"delete":{"tags":["resources"],"summary":"Delete a resource by kind and name","parameters":[{"schema":{"type":"string"},"description":"the kind of the resource","name":"kind","in":"path","required":true},{"schema":{"type":"string"},"description":"the name of the resource","name":"name","in":"path","required":true}],"responses":{"204":{"description":"Successful Delete, no content"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}}}}},"components":{"schemas":{"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}
```

## Server version

> Returns the current bindplane version of the server.

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/version":{"get":{"description":"Returns the current bindplane version of the server.","tags":["resources"],"summary":"Server version","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string"}}}}}}}}}
```

## GET /{kind}/{name}/history

> Get the history of a resource

```json
{"openapi":"3.1.1","info":{"title":"","version":"0.0.1"},"servers":[{"url":"/v1"}],"paths":{"/{kind}/{name}/history":{"get":{"tags":["resources"],"summary":"Get the history of a resource","parameters":[{"schema":{"type":"string"},"description":"the kind of the resource","name":"kind","in":"path","required":true},{"schema":{"type":"string"},"description":"the name of the resource","name":"name","in":"path","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.HistoryResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/model.ErrorResponse"}}}}}}}},"components":{"schemas":{"model.HistoryResponse":{"type":"object","properties":{"versions":{"type":"array","items":{"$ref":"#/components/schemas/model.AnyResource"}}}},"model.AnyResource":{"type":"object"},"model.ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"string"}}}}}}}
```
