Admin Endpoints

Update Exchange

  • Method: PATCH

  • Endpoint: /api/v1/crypto/exchanges/:id

  • Content-Type: multipart/form-data

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Parameters:

    • id: (integer) Exchange identifier in the database.

  • Body:

    • image: (file) Exchange logo or another reference image.

    • description: (string) Exchange textual description.

Description:

The /api/v1/crypto/exchanges/:id endpoint with the PATCH method is designed to update specific details of an existing cryptocurrency exchange in the database, identified by its unique id. This endpoint allows for the modification of an exchange's information, such as updating its logo (via an image file) and changing its textual description. The request must be made with the Content-Type set to multipart/form-data to support the uploading of files alongside text fields.

Example with curl:

curl -X PATCH "http://example.com/api/v1/crypto/exchanges/1" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: multipart/form-data" \
     -F "image=@/path_to_image/logo.png" \
     -F "description=Updated exchange description"

Example Response Payload:

{
    "data": {
        "id": 1,
        "externalExchangeId": "plenty",
        "dataSource": "Tezos",
        "type": "DEX",
        "name": "Plenty_DeFi",
        "description": "test",
        "imageUrl": "http://example.com/ccdb-reference/Exchanges/1",
        "createdAt": "2024-02-08T16:07:28.502Z",
        "updatedAt": "2024-02-26T12:24:44.367Z"
    },
    "status": 1
}

Create Markets

  • Method: POST

  • Endpoint: /api/v1/crypto/markets

  • Content-Type: application/json

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Body:

    • marketDataList: (array of objects) List of market data entries, each containing:

      • externalMarketId: (string) Required, must not be null or empty.

      • baseId: (positive integer) Required, must not be null or empty.

      • quoteId: (positive integer) Required, must not be null or empty.

      • exchangeId: (positive integer) Required, must not be null or empty.

      • meta: (object) Must not be null or empty.

      • baseMeta: (object) Must not be null or empty.

      • quoteMeta: (object) Must not be null or empty.

      • description: (string) Must not be null or empty.

      • active: (boolean) Must not be null or empty, defaults to false if not provided.

Description:

The /api/v1/crypto/markets endpoint with the POST method is designed to create multiple cryptocurrency markets in the database simultaneously. The request body should be formatted in application/json and include an array of market data entries under the marketDataList key. Each entry in this list requires several pieces of information for a market to be successfully created, including externalMarketId, baseId, quoteId, exchangeId, and optional metadata fields (meta, baseMeta, quoteMeta), a description, and an active status which determines if the market should be considered active immediately upon creation.

This operation not only saves the provided market configurations to the database but also has implications for the operational state of each market. Specifically, for markets collectors where the active field is set to true, the system triggers a reload process. This process notifies the relevant data collectors and systems that a new active market has been added, ensuring that data collection and any related activities are started or updated accordingly to include the new market information.

Example with curl:

curl -X POST "http://example.com/api/v1/crypto/markets" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: application/json" \
     -d '{
           "marketDataList": [
               {
                   "externalMarketId": "ETHUSDT",
                   "baseId": 10,
                   "quoteId": 9,
                   "exchangeId": 4,
                   "meta": {},
                   "baseMeta": {},
                   "quoteMeta": {},
                   "description": "Ethereum to USD Tether",
                   "active": true
               }
           ]
         }'

Example Response Payload:

{
    "data": [
        {
            "id": 10,
            "externalMarketId": "ETHUSDT",
            "baseId": 10,
            "quoteId": 9,
            "exchangeId": 4,
            "meta": {},
            "baseMeta": {},
            "quoteMeta": {},
            "description": "Ethereum to USD Tether",
            "imageUrl": null,
            "active": false,
            "createdAt": "2024-02-26T12:34:48.934Z",
            "updatedAt": "2024-02-26T12:34:48.934Z"
        }
    ],
    "status": 1
}

Update Many Markets

  • Method: PATCH

  • Endpoint: /api/v1/crypto/markets

  • Content-Type: application/json

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Body:

    • marketDataList: (array of objects) List of market data entries, each containing:

      • id: (positive integer) Required, must not be null or empty.

      • meta: (object) Can be any type of object.

      • baseMeta: (object) Can be any type of object.

      • quoteMeta: (object) Can be any type of object.

      • description: (string) Required, must not be null or empty.

Description:

The /api/v1/crypto/markets endpoint with the PATCH method is tailored for batch updating multiple cryptocurrency markets in the database. This operation allows for the modification of various attributes of markets through a single request. The Content-Type for the request must be application/json, and the body of the request should include a marketDataList, which is an array of market data entries. Each entry within this array must specify the id of the market to be updated and can include changes to meta, baseMeta, quoteMeta fields, as well as the description of the market.

This batch update process is significant for maintaining the accuracy and relevance of market data within the system. Importantly, for any market collector within the batch update where at least one of the meta, baseMeta, or quoteMeta fields is set or modified, the system triggers a reload process.

Example with curl:

curl -X PATCH "http://example.com/api/v1/crypto/markets" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: application/json" \
     -d '{
           "marketDataList": [
               {
                   "id": 4,
                   "meta": {"test": 1},
                   "baseMeta": null,
                   "quoteMeta": null,
                   "description": "Updated market description"
               }
           ]
         }'

Example Response Payload:

{
    "data": [
        {
            "id": 4,
            "externalMarketId": "BTCUSD",
            "baseId": 6,
            "quoteId": 7,
            "exchangeId": 4,
            "meta": {
                "test": 1
            },
            "baseMeta": null,
            "quoteMeta": null,
            "description": "test",
            "imageUrl": null,
            "active": true,
            "exchange": {
                "id": 4,
                "externalExchangeId": "bitfinex",
                "dataSource": "bitfinex",
                "type": "CEX",
                "name": "Bitfinex",
                "description": null,
                "imageUrl": null,
                "createdAt": "2024-02-09T00:08:54.450Z",
                "updatedAt": "2024-02-09T00:08:54.450Z"
            },
            "createdAt": "2024-02-09T00:09:06.732Z",
            "updatedAt": "2024-02-26T12:51:04.632Z"
        }
    ],
    "status": 1
}

Toggle Markets

  • Method: PATCH

  • Endpoint: /api/v1/crypto/markets

  • Content-Type: application/json

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Body:

    • toggleList: (array of objects) Required, must not be an empty list. Each object in the list should contain:

      • id: (positive integer) Required.

      • active: (boolean) Required.

Description:

The /api/v1/crypto/markets endpoint with the PATCH method, when used for toggling the activation status of markets, allows for bulk updating the active state (either activating or deactivating) of multiple markets in the database. This functionality is essential for efficiently managing the availability of markets for trading or data collection without needing to update each market individually. The request must be made with the Content-Type of application/json and include a toggleList, which is an array of objects. Each object within this array must contain two fields: id, which is the positive integer identifier of the market, and active, a boolean value indicating the new active state of the market.

This operation not only updates the specified markets' active states in the database but also has significant operational implications. Specifically, for each market collector whose activation status is changed by this request, a reload process is triggered.

Example with curl:

curl -X PATCH "http://example.com/api/v1/crypto/markets" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: application/json" \
     -d '{
           "toggleList": [
               {
                   "id": 4,
                   "active": true
               }
           ]
         }'

Example Response Payload:

{
    "data": [
        {
            "id": 4,
            "externalMarketId": "BTCUSD",
            "baseId": 6,
            "quoteId": 7,
            "exchangeId": 4,
            "meta": {
                "test": 1
            },
            "baseMeta": null,
            "quoteMeta": null,
            "description": "test",
            "imageUrl": null,
            "active": true,
            "exchange": {
                "id": 4,
                "externalExchangeId": "bitfinex",
                "dataSource": "bitfinex",
                "type": "CEX",
                "name": "Bitfinex",
                "description": null,
                "imageUrl": null,
                "createdAt": "2024-02-09T00:08:54.450Z",
                "updatedAt": "2024-02-09T00:08:54.450Z"
            },
            "createdAt": "2024-02-09T00:09:06.732Z",
            "updatedAt": "2024-02-26T12:51:04.632Z"
        }
    ],
    "status": 1
}

Update Market

  • Method: PATCH

  • Endpoint: /api/v1/crypto/markets/:id

  • Content-Type: multipart/form-data

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Parameters:

    • id: (integer) Market identifier in the database.

  • Body:

    • image: (file) Market logo or another reference image.

    • description: (string) Market textual description.

Description:

To update a specific market in the database identified by its id, you can use the PATCH method on the /api/v1/crypto/markets/:id endpoint. This operation allows for the modification of market details, such as updating its logo through an image file and changing its textual description. The request should be made with the Content-Type set to multipart/form-data to support the file upload along with text fields.

Example with curl:

curl -X PATCH "http://example.com/api/v1/crypto/markets/5" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: multipart/form-data" \
     -F "image=@/path_to_new_market_image.jpg" \
     -F "description=Updated market description"

Example Response Payload:

{
    "data": {
        "id": 5,
        "externalMarketId": "BTCEUR",
        "baseId": 6,
        "quoteId": 8,
        "exchangeId": 4,
        "meta": null,
        "baseMeta": null,
        "quoteMeta": null,
        "description": "test",
        "imageUrl": "http://example.com/ccdb-reference/Markets/5",
        "active": true,
        "exchange": {
            "id": 4,
            "externalExchangeId": "bitfinex",
            "dataSource": "bitfinex",
            "type": "CEX",
            "name": "Bitfinex",
            "description": null,
            "imageUrl": null,
            "createdAt": "2024-02-09T00:08:54.450Z",
            "updatedAt": "2024-02-09T00:08:54.450Z"
        },
        "createdAt": "2024-02-09T00:09:06.744Z",
        "updatedAt": "2024-02-26T12:58:50.051Z"
    },
    "status": 1
}

Delete Markets

  • Method: DELETE

  • Endpoint: /api/v1/crypto/markets

  • Content-Type: application/json

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Body:

    • marketIds: (array of positive integers) Required, must not be an empty list. Each element in the list should be a positive integer.

Description:

To delete specified markets from the database, you can use the DELETE method on the /api/v1/crypto/markets endpoint. This operation requires a request body formatted in application/json that includes a marketIds key. The value of this key should be an array of positive integers, where each integer represents the identifier (id) of a market to be deleted. This endpoint facilitates the bulk deletion of markets, making it easier to manage the dataset by removing multiple entries in a single operation.

The deletion process not only removes the specified markets from the database but also has operational implications. Specifically, for each market collector that was active at the time of deletion, the system triggers a reload process.

Example with curl:

curl -X DELETE "http://example.com/api/v1/crypto/markets" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: application/json" \
     -d '{"marketIds": [1, 2, 3]}'

Example Response Payload:

{
    "status": 1
}

Create Token

  • Method: POST

  • Endpoint: /api/v1/crypto/tokens

  • Content-Type: multipart/form-data

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Body:

    • symbol: (string) Required, must not be null or empty.

    • name: (string) Must not be null or empty.

    • itin: (string) Must not be null or empty.

    • description: (string) Must not be null or empty.

    • image: (file) Token logo or another reference image.

Description:

The /api/v1/crypto/tokens endpoint with a POST method is designed for creating a new cryptocurrency token entry in the database. This operation requires submitting details about the token, such as its symbol, name, International Token Identification Number (ITIN), description, and an optional logo or reference image. The Content-Type must be set to multipart/form-data to accommodate the file upload alongside the textual data.

Example with curl:

curl -X POST "http://example.com/api/v1/crypto/tokens" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: multipart/form-data" \
     -F "symbol=TTC" \
     -F "name=TestToken" \
     -F "itin=QTY2-F9RV-3" \
     -F "description=A detailed description of the token." \
     -F "image=@/path_to_image/token_logo.png"

Example Response Payload:

{
    "data": {
        "id": 17,
        "symbol": "TTC",
        "name": "TestToken",
        "itin": "QTY2-F9RV-3",
        "description": "test",
        "imageUrl": "http://example.com/ccdb-reference/Tokens/17",
        "createdAt": "2024-02-20T11:07:44.449Z",
        "updatedAt": "2024-02-20T11:07:44.468Z"
    },
    "status": 1
}

Update Token

  • Method: PATCH

  • Endpoint: /api/v1/crypto/tokens/:id

  • Content-Type: multipart/form-data

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Parameters:

    • id: (integer) Token identifier in the database.

  • Body:

    • image: (file) Token logo or another reference image.

    • description: (string) Token textual description.

Description:

The /api/v1/crypto/tokens/:id endpoint with a PATCH method allows for updating specific details of an existing token in the database, identified by its id. This operation is particularly useful for modifying a token's description or updating its logo, ensuring that the token's information remains current and accurate. The request must be made with the Content-Type set to multipart/form-data to support file upload for the token's image alongside textual data for the description.

Example with curl:

curl -X PATCH "http://example.com/api/v1/crypto/tokens/17" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here" \
     -H "Content-Type: multipart/form-data" \
     -F "image=@/path_to_new_image/new_token_logo.png" \
     -F "description=Updated description of the token."

Example Response Payload:

{
    "data": {
        "id": 17,
        "symbol": "TTC",
        "name": "TestToken",
        "itin": null,
        "description": "test",
        "imageUrl": "http://example.com/ccdb-reference/Tokens/17",
        "createdAt": "2024-02-20T11:07:44.449Z",
        "updatedAt": "2024-02-20T11:07:44.468Z"
    },
    "status": 1
}

Delete Token

  • Method: DELETE

  • Endpoint: /api/v1/crypto/markets/:id

  • Headers:

    • Cookie: The session cookie value.

    • csrf_token: The CSRF token obtained after login.

  • Parameters:

    • id: (integer) Token identifier in the database.

Description:

The /api/v1/crypto/markets/:id endpoint with a DELETE method is designed to remove a specific cryptocurrency token from the database, identified by its unique id. This operation will only succeed if the token is not currently referenced in any market. This means that if the token is part of any trading pair or has been used in transactions, trades, or any other market-related collection activities, the deletion request will be denied to preserve data integrity and avoid breaking any dependencies within the database. This safeguard ensures that the deletion of a token does not inadvertently affect market data or historical records.

Example with curl:

curl -X DELETE "http://example.com/api/v1/crypto/markets/17" \
     -H "Cookie: session_cookie_value"  \
     -H "csrf_token: your_csrf_token_here"

Example Response Payload:

{
    "status": 1
}

Last updated