# JSON API

{% hint style="info" %}
The first version of MAN has been launched and open-sourced. For subsequent deployment and API documentation, please refer to the documents on Github
{% endhint %}

## Basic API

<table><thead><tr><th>address</th><th>method</th><th width="165">parameter</th><th> describe</th></tr></thead><tbody><tr><td>/api/pin/{numberOrId}</td><td>GET</td><td>PIN number or PIN id</td><td>Get PIN Details by PIN Number or PIN ID</td></tr><tr><td>/api/address/pin/list/{addressType/{address}</td><td>GET</td><td>address<br>addressType ：creator，owner</td><td>Retrieve the list of PINs created or owned by the specified address.</td></tr><tr><td>/api/address/pin/root/{address}</td><td>GET</td><td>address</td><td>Get PIN Root by Address</td></tr><tr><td>/api/node/child/{pinId}</td><td>GET</td><td>pinId</td><td>Get Child Node by PIN ID</td></tr><tr><td>/api/node/parent/{pinId}</td><td>GET</td><td>pinId</td><td>Get Parent Node by PIN ID</td></tr><tr><td>/api/info/address/{address}</td><td>GET</td><td>address</td><td>Get MetaID Info by Address</td></tr><tr><td>/api/info/rootId/{rootId}</td><td>GET</td><td>rootId</td><td>Get MetaID Info by Root ID</td></tr><tr><td>/api/pin/content/{numberOrId}</td><td>GET</td><td>PIN number or PIN id</td><td>Get PIN Content by PIN Number or PIN ID</td></tr><tr><td>/api/getAllPinByParentPath</td><td>GET</td><td>page,limit,parentPath</td><td>Get All Pins by Parent Path</td></tr></tbody></table>

## generalQuery

General query for protocols data, supporting data retrieval in get, count, and sum methods.&#x20;

Endpoint: /api/generalQuery

**method:** POST

```jsx
{
    "collection": "pins", // Name of the collection to query, required
    "action": "sum", // Query operation, supports get, count, sum
    "filterRelation": "or", // Query condition relationship, supports or, and. Currently does not support mixing.
    "field": [
        "number" // Field(s) to return in the query, required for sum operation
    ],
    // Query conditions
    "filter": [
        {
            "operator": "=", // Condition operator, supports =, >, >=, <, <=
            "key": "number", // Field to apply the condition
            "value": 1 // Value to query
        },
        {
            "operator": "=",
            "key": "number",
            "value": 2
        }
    ],
    "cursor": 0, // Starting point for returning data
    "limit": 1, // Number of data records to return
    "sort": [
        "number", // Field to sort by
        "desc" // Order, supports asc, desc
    ]
}
```

#### Successful Response Example

```jsx
{
    "code": 1, // Success code 1
    "message": "ok", // Response message
    "data": [ // Data content
        {
            "_id": "65e96a276bff93b007c02b16",
            "isLike": "1",
            "likeTo": "32c6d91b6fb3f6746258d83f1fe8fb32f19c2a3e0071847b6046f01c938ca20bi0",
            "pinAddress": "tb1pss8ce6tgupnhmfj8u9h4saue48upucu04c7549tzal6n67v8njyst7e0fx",
            "pinId": "3943f7fa4c8496ced9ff722ae5bbdd57ad7b84a383304890b41f21e12f11086bi0",
            "pinNumber": 69
        }
    ]
}
```

#### Failed Response Example

```jsx
{
    "code": -1, // Failure code
    "message": "Data not found", // Reason for failure
    "data": null
}
```
