Skip to content

Commit

Permalink
Fix import actions doc
Browse files Browse the repository at this point in the history
  • Loading branch information
m-tabaza committed Aug 27, 2024
1 parent 5cc0ac6 commit 333fae4
Showing 1 changed file with 1 addition and 66 deletions.
67 changes: 1 addition & 66 deletions docs/api-reference/endpoint/import-actions-from-swagger.mdx
Original file line number Diff line number Diff line change
@@ -1,68 +1,3 @@
---
title: "Import actions"
api: "PUT https://api-v2.opencopilot.so/backend/actions/bot/:id/import-from-swagger"
description: "Import actions from a Swagger file to a copilot by ID"
openapi: put /actions
---

<Warning>
This endpoint points to the (v2) version of the API. The (v2) version of the API is the latest version and is recommended for all new development. Please update your code to use the (v2) version of the API.
</Warning>


### OpenAPI Specification (Swagger)

This endpoint supports the [OpenAPI V3 Specification (Swagger)](https://swagger.io/specification/). We have introduced some new fields to the OpenAPI specification that are custom to Open. These fields are:

- **`x-open-execute-after`: `string[]`**
This field is useful when you want to execute other operation(s) before the current operation/action. it takes an array of operation IDs. The AI will execute the operations in the order they are listed in the array.

**Example:**

Suppose you have an action with the operation ID `deleteUserCourses`. Before performing this action, you want to force the AI to list all the courses the user has and then delete them.

You can achieve this by adding `['listUserCourses']` to the `x-open-execute-after` field. The AI will first execute the `listUserCourses` operation and then proceed to execute the `deleteUserCourses` operation.


### Body

<ParamField path="id" type="string">
The uuid of the copilot
</ParamField>

### Headers

<ParamField path="header" name="Accept" type="string">
application/json
</ParamField>

<ParamField path="header" name="Authorization" type="string">
Bearer YOUR_TOKEN
</ParamField>


### Response

<ResponseField name="message" type="string">
Indicates whether the call was successful.
</ResponseField>

<RequestExample>

```bash Example Request
curl --location --request PUT 'https://api-v2.opencopilot.so/backend/actions/bot/:id/import-from-swagger' \
--header 'Accept: application/json' \
--header 'Authorization : Bearer YOUR_TOKEN' \
--form 'file=@"/Users/gharbat/Desktop/swagger.json"'
```

</RequestExample>

<ResponseExample>

```json Response
{
"message": "Successfully imported actions from swagger.json"
}
```

</ResponseExample>

0 comments on commit 333fae4

Please sign in to comment.