πŸ€ͺIntegration API

This endpoint retrieves all integration data from a specified Twitter user. It fetches and processes tweets containing a specific welcome message and integrates the information into the system.

Route: /integration/all

Parameters:

  • No parameters are required for this endpoint.

Request Example:

GET /integration/all

Response:

The response contains an array of objects, each representing an integration. The structure of each object includes:

  • about:

    • Description: Description of the user who posted the referenced tweet.

    • Type: String

  • name:

    • Description: Name of the user who posted the referenced tweet.

    • Type: String

  • img:

    • Description: Profile image URL of the user who posted the referenced tweet.

    • Type: String

  • link:

    • Description: JSON string containing links to the user's website and Twitter profile.

    • Type: String

    • Format:

      {
        "website": "URL to the user's website",
        "twitter": "URL to the user's Twitter profile"
      }
  • isoDate:

    • Description: ISO 8601 formatted date of the tweet.

    • Type: String

  • date:

    • Description: Unix timestamp of the tweet.

    • Type: Number

  • id:

    • Description: Twitter username of the user who posted the referenced tweet.

    • Type: String

    spotlight:

    • Description: to know if an integration has been highlighted.

    • Type: String

Response Example:

{
  "status": true,
  "data": [
    {
      "about": "Tech enthusiast and blockchain advocate.",
      "name": "John Doe",
      "img": "https://example.com/profile.jpg",
      "link": "{\"website\":\"https://johndoe.com\",\"twitter\":\"https://x.com/johndoe\"}",
      "isoDate": "2023-05-27T14:30:00Z",
      "date": 1685190600000,
      "id": "johndoe",
      "spotlight":"true"
    },
    {
      "about": "Blockchain developer and cryptocurrency expert.",
      "name": "Jane Smith",
      "img": "https://example.com/profile2.jpg",
      "link": "{\"website\":\"https://janesmith.com\",\"twitter\":\"https://x.com/janesmith\"}",
      "isoDate": "2023-05-26T10:15:00Z",
      "date": 1685150100000,
      "id": "janesmith",
      "spotlight":"false"
    }
  ]
}

Integration Spotlight

Set the spotlight on an integration

  • URL: /integration/spotlight

  • Method: POST

  • Authentication: Required (Bearer Token)

  • Request Body:

    • id(String): Integration id.

    • spotlight(boolean, optional): true or false for spotlight. default is false.

Example Request:

POST /stats/save
Authorization: Bearer <TOKEN>
Content-Type: application/json

{
    "id": "Paal_Ai",
    "spotlight": true,
}

Example Response (Success):

{
    "status": true
}

Example Response (Error):

{
    msg: "Request missing some parametres",
    status: 'error',
    error: '1052'
}

Here is a GitBook-style documentation for the /integration/new endpoint:


Create a New Integration

POST /integration/new

This endpoint creates a new integration record.

Headers

  • Authorization: Bearer token (required)

Request Parameters

Parameter
Type
Description

about

String

A brief description of the integration (required).

name

String

The name of the integration (optional).

link

String

A URL link related to the integration (optional).

postUrl

String

The URL where the integration data will be posted (optional).

date

UnixTimeStamp

The timestamp representing the date of the integration (optional).

username

String

The username associated with the integration (required).

spotlight

String

Indicates if the integration is featured; can be 'true' or 'false' (optional).

file

ImageFile

An optional image file to be uploaded.

chain

Number(800 for solana)

The integrated project blockchain

address

String

The token contract address

File Upload

  • file (optional): Accepts an image file to be associated with the integration.

  • The file must be of a valid image type (e.g., JPEG, PNG) and should not exceed the maximum size limit defined by the server (MAX_IMAGE_SIZE).

Request Example

curl -X POST "https://yourapi.com/integration/new" \
-H "Authorization: Bearer your-access-token" \
-F "about=New Integration for XYZ" \
-F "name=Integration XYZ" \
-F "link=https://example.com" \
-F "postUrl=https://example.com/post" \
-F "date=1680273000" \
-F "username=user123" \
-F "spotlight=true" \
-F "file=@/path/to/image.png"

Response

  • Success: Returns a status of true and the id of the created integration.

    {
      "status": true,
      "id": "integration_id"
    }
  • Error: Returns an error object with relevant details.

    • File Too Large: If the uploaded image file exceeds the maximum size.

      {
        "error": "File too large",
        "MAX_SIZE": 1048576
      }
    • Internal Server Error: If there is an error in the database or server.

      {
        "error": "Internal Server Error"
      }
    • Missing Parameters: If required parameters are missing.

      {
        "error": "Missing parameters"
      }

Behavior

  • Checks for the presence of required fields (about and username).

  • Validates the optional image file type and size. If the file is valid and within the size limit, it is processed and stored.

  • Creates a new integration record in the database using the provided details.

  • Returns a success response with the integration ID if creation is successful; otherwise, returns an error response.

Authorization

  • This endpoint requires a valid authorization token to be passed in the headers.

Notes

  • Ensure that the file parameter is of a valid image type and does not exceed the server-defined MAX_IMAGE_SIZE.

  • The username serves as the unique identifier for the integration.

Retrieve Integration Data

GET /integration

Retrieves integration data based on the provided integrationId query parameter.

Parameters:

  • integrationId (string, required): The ID of the integration to retrieve.

Response:

  • Returns integration details including name, about, category, image, spotlight status, transaction ID, and other metadata.

Authentication:

  • Not required.


Retrieve Integration Market Data

GET /integration/:id/market

Fetches market data for a specific integration based on its ID.

Parameters:

  • id (string, required): The ID of the integration.

Response:

  • Returns market information for the integration if available.

Authentication:

  • Not required.


Modify Integration Data

POST /integration/save

Modifies an existing integration by updating its details or uploading a file.

Parameters:

  • integrationId (string, required): The ID of the integration.

  • name (string, optional): The name of the integration.

  • about (string, optional): A description of the integration.

  • link (JSON string, optional): A JSON object containing website and Twitter links.

  • postUrl (string, optional): URL of the post related to the integration.

  • file (file, optional): An image file associated with the integration.

Response:

  • Returns status of the modification process.

Authentication:

  • Required.

File Upload Limit:

  • Max file size is defined in system configuration.


Delete Integration Data

POST /integration/delete

Deletes an integration based on the provided integrationId.

Parameters:

  • integrationId (string, required): The ID of the integration to be deleted.

Response:

  • Returns success status if deletion is successful.

Authentication:

  • Required.


Set Integration Spotlight

POST /integration/spotlight

Updates the spotlight status of an integration.

Parameters:

  • id (string, required): The ID of the integration.

  • spotlight (boolean, required): Whether to set the integration in the spotlight.

Response:

  • Returns success status if the update is successful.

Authentication:

  • Required.


Retrieve Integration Image

GET /integration/img/:id

Retrieves the image associated with an integration.

Parameters:

  • id (string, required): The ID of the integration.

Response:

  • Returns the image file in its original format.

  • If no image is found, returns a 404 error.

Authentication:

  • Not required.


Last updated