Getting Started with API
Purpose: This API serves as the backend for our MOTI DID Protocol, allowing users to create, read and update MOTI.BIO profile, manage user accounts.
Prerequisites
Development Environment: Set up a development environment with your preferred programming language (e.g, JavaScript).
Ensure you have the necessary libraries installed. For JavaScript, you can use `fetch` or libraries like `axios`.
Basic Concepts
Endpoint: The URL where the API is accessed.
HTTP Methods:
GET
: Retrieve data.POST
: Send data.PUT
: Update data.DELETE
: Remove data.
Headers: Additional information sent with the request (e.g., Authorization, Content-Type). For the MOTI API, headers are not used.
Parameters: Data sent with the request, either in the URL for GET
requests or in the body for POST
/PUT
requests.
Base URL: Know the base URL of the API
TaskID and Base URL
After deploying a task on Koii, a TASKID
is generated. The TASKID
might change when the task is updated.
TaskID Example:
CqxkAGdno3FDEB3gkcnCKMo2s9jwHnkaMEp8FsQy6qcB
Base URL:
https://app.moti.bio/task/${TaskID}/
Making API Requests and Handling Responses
GET Request
Retrieve a list of linktree items:
POST Request
Create a new linktree item:
PUT Request
Update an existing linktree item:
Endorsements API
POST Request - Create Endorsement
Create a new endorsement:
GET Request - Fetch Endorsements
Retrieve endorsements using a public key:
Common API Operations
Fetching Data (GET): Retrieve information from the API.
Sending Data (POST): Submit new data to the API.
Updating Data (PUT/PATCH): Modify existing data in the API.
Error Handling
MOTI.BIO uses standard HTTP response codes:
2xx: Success
4xx: Client errors (e.g., missing parameters)
5xx: Server errors (rare)
This guide provides the essentials for interacting with the MOTI API using JavaScript. Understanding these concepts and examples will help you efficiently integrate MOTI functionalities into your applications.
Last updated