How to generate Alfresco API client libraries - Part 1: Python

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate Alfresco API client libraries - Part 1: Python

Jatherton
Active Member II
3 0 4,686

As a third party wishing to integrate with Alfresco, you can use OpenAPI tooling to generate bindings for over 20 different languages. Here is an example of how to use swagger-codegen to generate Python bindings.

The schema can also be used to generate client bindings in many languages using swagger-codegen. The schema is available for your local Alfresco at /api-explorer/.

The “Getting Started” section of swagger-codegen documentation contains a link to the latest version of the jar that can be used to generate a client for Alfresco. The example below can be used to generate the Python client.

 

Step 1: Install Swagger Codegen

Read the following resource: https://swagger.io/docs/open-source-tools/swagger-codegen/

In this example I am using the brew install.

brew install swagger-codegen
swagger-codegen config-help -l python


Step 2: Generate the client library!

The API definition files can be found here GitHub - Swagger definitions 

swagger-codegen generate -i https://api-explorer.alfresco.com/api-explorer/definitions/alfresco-core.yaml -l python -o ./my_alfresco_client

Your Swagger API client will be at the location you specifed in the -o argument. 

I am using a Mac in this example but this is just as easily done on Windows.

In Part 2 we will generate a Swift client!