$ openapi-generator-cli -- generate -i spec3.json -g python -o ./openapi
I've only changed name of the package in pyproject.toml
Spec taken from here: https://raw.githubusercontent.com/outline/openapi/3e0d51dc54c3ed30d2935cdb187d143f5ff78c29/spec3.json
The Outline API is structured in an RPC style. It enables you to programatically interact with all aspects of Outline’s data – in fact, the main application is built on exactly the same API.
The API structure is available as an openapi specification if that’s your jam – it can be used to generate clients for most programming languages.
Outline’s API follows simple RPC style conventions where each API endpoint is
a method on https://app.getoutline.com/api/method
. Both GET
and POST
methods are supported but it’s recommended that you make all call using POST.
Only HTTPS is supported and all response payloads are JSON.
When making POST
requests, request parameters are parsed depending on
Content-Type header. To make a call using JSON payload, you must pass
Content-Type: application/json header, here’s an example using CURL:
curl https://app.getoutline.com/api/documents.info \\
-X 'POST' \\
-H 'authorization: Bearer MY_API_KEY' \\
-H 'content-type: application/json' \\
-H 'accept: application/json' \\
-d '{\"id\": \"outline-api-NTpezNwhUP\"}'
Or, with JavaScript:
const response = await fetch(\"https://app.getoutline.com/api/documents.info\", {
method: \"POST\",
headers: {
Accept: \"application/json\",
\"Content-Type\": \"application/json\",
Authorization: \"Bearer MY_API_KEY\"
}
})
const body = await response.json();
const document = body.data;
To access API endpoints, you must provide a valid API key. You can create new API keys in your account settings. Be careful when handling your keys as they give access to all of your documents, you should treat them like passwords and they should never be committed to source control.
To authenticate with API, you can supply the API key as a header
(Authorization: Bearer YOUR_API_KEY
) or as part of the payload using token
parameter. Header based authentication is highly recommended so that your keys
don’t accidentally leak into logs.
Some API endpoints allow unauthenticated requests for public resources and they can be called without an API key.
All successful API requests will be returned with a 200 or 201 status code
and ok: true
in the response payload. If there’s an error while making the
request, the appropriate status code is returned with the error message:
{
\"ok\": false,
\"error\": \"Not Found\"
}
Most top-level API resources have support for "list" API methods. For instance,
you can list users, documents, and collections. These list methods share
common parameters, taking both limit
and offset
.
Responses will echo these parameters in the root pagination
key, and also
include a nextPath
key which can be used as a handy shortcut to fetch the
next page of results. For example:
{
ok: true,
status: 200,
data: […],
pagination: {
limit: 25,
offset: 0,
nextPath: \"/api/documents.list?limit=25&offset=25\"
}
}
Most API resources have associated "policies", these objects describe the current API keys authorized actions related to an individual resource. It should be noted that the policy "id" is identical to the resource it is related to, policies themselves do not have unique identifiers.
For most usecases of the API, policies can be safely ignored. Calling unauthorized methods will result in the appropriate response code – these can be used in an interface to adjust which elements are visible.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.1.0
- Package version: 1.0.0
- Generator version: 7.4.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 3.7+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import openapi_client
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import openapi_client
Execute pytest
to run the tests.
Please follow the installation procedure and then run the following:
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://app.getoutline.com/api
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "https://app.getoutline.com/api"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization (JWT): http
configuration = openapi_client.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.AttachmentsApi(api_client)
attachments_create_post_request = openapi_client.AttachmentsCreatePostRequest() # AttachmentsCreatePostRequest | (optional)
try:
# Create an attachment
api_response = api_instance.attachments_create_post(attachments_create_post_request=attachments_create_post_request)
print("The response of AttachmentsApi->attachments_create_post:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling AttachmentsApi->attachments_create_post: %s\n" % e)
All URIs are relative to https://app.getoutline.com/api
Class | Method | HTTP request | Description |
---|---|---|---|
AttachmentsApi | attachments_create_post | POST /attachments.create | Create an attachment |
AttachmentsApi | attachments_delete_post | POST /attachments.delete | Delete an attachment |
AttachmentsApi | attachments_redirect_post | POST /attachments.redirect | Retrieve an attachment |
AuthApi | auth_config_post | POST /auth.config | Retrieve auth config |
AuthApi | auth_info_post | POST /auth.info | Retrieve auth |
CollectionsApi | collections_add_group_post | POST /collections.add_group | Add a group to a collection |
CollectionsApi | collections_add_user_post | POST /collections.add_user | Add a collection user |
CollectionsApi | collections_create_post | POST /collections.create | Create a collection |
CollectionsApi | collections_delete_post | POST /collections.delete | Delete a collection |
CollectionsApi | collections_documents_post | POST /collections.documents | Retrieve a collections document structure |
CollectionsApi | collections_export_all_post | POST /collections.export_all | Export all collections |
CollectionsApi | collections_export_post | POST /collections.export | Export a collection |
CollectionsApi | collections_group_memberships_post | POST /collections.group_memberships | List all collection group members |
CollectionsApi | collections_info_post | POST /collections.info | Retrieve a collection |
CollectionsApi | collections_list_post | POST /collections.list | List all collections |
CollectionsApi | collections_memberships_post | POST /collections.memberships | List all collection memberships |
CollectionsApi | collections_remove_group_post | POST /collections.remove_group | Remove a collection group |
CollectionsApi | collections_remove_user_post | POST /collections.remove_user | Remove a collection user |
CollectionsApi | collections_update_post | POST /collections.update | Update a collection |
CommentsApi | comments_create_post | POST /comments.create | Create a comment |
CommentsApi | comments_delete_post | POST /comments.delete | Delete a comment |
CommentsApi | comments_list_post | POST /comments.list | List all comments |
CommentsApi | comments_update_post | POST /comments.update | Update a comment |
DocumentsApi | documents_archive_post | POST /documents.archive | Archive a document |
DocumentsApi | documents_create_post | POST /documents.create | Create a document |
DocumentsApi | documents_delete_post | POST /documents.delete | 8000 Delete a document |
DocumentsApi | documents_drafts_post | POST /documents.drafts | List all draft documents |
DocumentsApi | documents_export_post | POST /documents.export | Export a document as markdown |
DocumentsApi | documents_import_post | POST /documents.import | Import a file as a document |
DocumentsApi | documents_info_post | POST /documents.info | Retrieve a document |
DocumentsApi | documents_list_post | POST /documents.list | List all documents |
DocumentsApi | documents_move_post | POST /documents.move | Move a document |
DocumentsApi | documents_restore_post | POST /documents.restore | Restore a document |
DocumentsApi | documents_search_post | POST /documents.search | Search all documents |
DocumentsApi | documents_star_post | POST /documents.star | Star a document |
DocumentsApi | documents_templatize_post | POST /documents.templatize | Create a template from a document |
DocumentsApi | documents_unpublish_post | POST /documents.unpublish | Unpublish a document |
DocumentsApi | documents_unstar_post | POST /documents.unstar | Unstar a document |
DocumentsApi | documents_update_post | POST /documents.update | Update a document |
DocumentsApi | documents_viewed_post | POST /documents.viewed | List all recently viewed documents |
EventsApi | events_list_post | POST /events.list | List all events |
FileOperationsApi | file_operations_delete_post | POST /fileOperations.delete | Delete a file operation |
FileOperationsApi | file_operations_info_post | POST /fileOperations.info | Retrieve a file operation |
FileOperationsApi | file_operations_list_post | POST /fileOperations.list | List all file operations |
FileOperationsApi | file_operations_redirect_post | POST /fileOperations.redirect | Retrieve the file |
GroupsApi | groups_add_user_post | POST /groups.add_user | Add a group member |
GroupsApi | groups_create_post | POST /groups.create | Create a group |
GroupsApi | groups_delete_post | POST /groups.delete | Delete a group |
GroupsApi | groups_info_post | POST /groups.info | Retrieve a group |
GroupsApi | groups_list_post | POST /groups.list | List all groups |
GroupsApi | groups_memberships_post | POST /groups.memberships | List all group members |
GroupsApi | groups_remove_user_post | POST /groups.remove_user | Remove a group member |
GroupsApi | groups_update_post | POST /groups.update | Update a group |
RevisionsApi | revisions_info_post | POST /revisions.info | Retrieve a revision |
RevisionsApi | revisions_list_post | POST /revisions.list | List all revisions |
SharesApi | shares_create_post | POST /shares.create | Create a share |
SharesApi | shares_info_post | POST /shares.info | Retrieve a share object |
SharesApi | shares_list_post | POST /shares.list | List all shares |
SharesApi | shares_revoke_post | POST /shares.revoke | Revoke a share |
SharesApi | shares_update_post | POST /shares.update | Update a share |
UsersApi | users_activate_post | POST /users.activate | Activate a user |
UsersApi | users_delete_post | POST /users.delete | Delete a user |
UsersApi | users_info_post | POST /users.info | Retrieve a user |
UsersApi | users_invite_post | POST /users.invite | Invite users |
UsersApi | users_list_post | POST /users.list | List all users |
UsersApi | users_suspend_post | POST /users.suspend | Suspend a user |
UsersApi | users_update_post | POST /users.update | Update a user |
UsersApi | users_update_role_post | POST /users.update_role | Change a users role |
ViewsApi | views_create_post | POST /views.create | Create a view |
ViewsApi | views_list_post | POST /views.list | List all views |
- Attachment
- AttachmentsCreatePost200Response
- AttachmentsCreatePost200ResponseData
- AttachmentsCreatePostRequest
- AttachmentsDeletePost200Response
- AttachmentsRedirectPostRequest
- Auth
- AuthConfigPost200Response
- AuthConfigPost200ResponseData
- AuthConfigPost200ResponseDataServicesInner
- AuthInfoPost200Response
- Collection
- CollectionGroupMembership
- CollectionSort
- CollectionsAddGroupPost200Response
- CollectionsAddGroupPost200ResponseData
- CollectionsAddGroupPostRequest
- CollectionsAddUserPost200Response
- CollectionsAddUserPost200ResponseData
- CollectionsAddUserPostRequest
- CollectionsCreatePost200Response
- CollectionsCreatePostRequest
- CollectionsDeletePostRequest
- CollectionsDocumentsPost200Response
- CollectionsExportAllPostRequest
- CollectionsExportPost200Response
- CollectionsExportPost200ResponseData
- CollectionsExportPostRequest
- CollectionsGroupMembershipsPost200Response
- CollectionsGroupMembershipsPost200ResponseData
- CollectionsGroupMembershipsPostRequest
- CollectionsInfoPost200Response
- CollectionsInfoPostRequest
- CollectionsListPost200Response
- CollectionsMembershipsPost200Response
- CollectionsMembershipsPostRequest
- CollectionsRemoveGroupPostRequest
- CollectionsRemoveUserPostRequest
- CollectionsUpdatePostRequest
- Comment
- CommentsCreatePost200Response
- CommentsCreatePostRequest
- CommentsListPost200Response
- CommentsListPostRequest
- CommentsUpdatePostRequest
- Document
- DocumentsCreatePost200Response
- DocumentsCreatePostRequest
- DocumentsDeletePostRequest
- DocumentsDraftsPostRequest
- DocumentsExportPost200Response
- DocumentsExportPostRequest
- DocumentsInfoPost200Response
- DocumentsInfoPostRequest
- DocumentsListPostRequest
- DocumentsMovePost200Response
- DocumentsMovePost200ResponseData
- DocumentsMovePostRequest
- DocumentsRestorePostRequest
- DocumentsSearchPost200Response
- DocumentsSearchPost200ResponseDataInner
- DocumentsSearchPostRequest
- DocumentsStarPost200Response
- DocumentsStarPostRequest
- DocumentsUpdatePostRequest
- DocumentsViewedPostRequest
- Error
- Event
- EventsListPost200Response
- EventsListPostRequest
- FileOperation
- FileOperationCollection
- FileOperationsInfoPost200Response
- FileOperationsInfoPostRequest
- FileOperationsListPost200Response
- FileOperationsListPostRequest
- Group
- GroupMembership
- GroupsAddUserPost200Response
- GroupsAddUserPost200ResponseData
- GroupsAddUserPostRequest
- GroupsCreatePost200Response
- GroupsCreatePostRequest
- GroupsInfoPost200Response
- GroupsInfoPostRequest
- GroupsListPost200Response
- GroupsMembershipsPost200Response
- GroupsMembershipsPost200ResponseData
- GroupsMembershipsPostRequest
- GroupsRemoveUserPost200Response
- GroupsRemoveUserPost200ResponseData
- GroupsUpdatePostRequest
- Invite
- Membership
- NavigationNode
- Pagination
- Permission
- Policy
- PolicyAbilities
- Revision
- RevisionsInfoPost200Response
- RevisionsInfoPostRequest
- RevisionsListPost200Response
- Share
- SharesCreatePostRequest
- SharesInfoPost200Response
- SharesInfoPostRequest
- SharesListPost200Response
- SharesUpdatePostRequest
- Sorting
- Team
- User
- UserRole
- UsersInfoPost200Response
- UsersInfoPostRequest
- UsersInvitePost200Response
- UsersInvitePostRequest
- UsersListPost200Response
- UsersListPostRequest
- UsersUpdatePostRequest
- UsersUpdateRolePostRequest
- View
- ViewsCreatePost200Response
- ViewsListPost200Response
Authentication schemes defined for the API:
- Type: Bearer authentication (JWT)