Skip to content

ayyeka/restapi-apiclient-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

REST-API client example code in python

This is a simple example of a REST-API client developed in python, users can use this code as a boilerplate to integrate with Ayyeka's FAI platform, example code only works with version 2.0 of REST-API.

When running the code the following steps will be executed:

  1. Authentication using a specified API Key, Secret in order to acquire an access token.
  2. Fetch and print out metadata (sites, samples).
  3. A loop that fetches new samples from the FAI Rest-API every 15min.

Prerequisites

API Key and Secret

  • Follow the instructions at Ayyeka Developer Portal to generate the API Key,Secret.
  • Update the Program.cs with generated the API Key,Secret.
    API_KEY = "API-KEY-HERE";
    API_SECRET = "API-SECRET-HERE";

   

Developer Environment & Tools

  • We used python 3.10 with VScode.
  • We used swagger-codegen to generate the API client in python.
  • We used openapi3.json openapi3.0 spec file Ayyek REST-API

How to generate and install swagger_client

  1. Download the swagger-codegen jar from https://swagger.io/docs/open-source-tools/swagger-codegen/

  2. Run the following command:

java -jar .\swagger-codegen-cli.jar generate  -i .\openapi3.json  -l python   -o  .\gen

  1. In gen folder run the following command that will install the swagger_client:
python .\setup.py install

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published