Get the merged AssetTree

The Numbers Commits system operates analogously to the Git version control system. Each commit operation generates a corresponding AssetTree file. This API is designed to merge AssetTree files derived from a AssetTree list, effectively building a comprehensive, unified record of asset histories. The API requires a list of AssetTree Nids as well as the timestamp generated with a valid Capture Token for authorization. If you do not already have a Capture Token yet, please follow the instruction provided to create one.

The required data format is the same as the commits list from the output of Read commits via API.

API Endpoint: https://eoqlryxobmjf9kw.m.pipedream.net

Cost: 0 NUM (free to use)

Method: POST

Description:
This endpoint accepts a JSON array of commit objects, each consisting of an assetTreeCid and timestampCreated.

Authentication:
This API requires a valid token for Authorization. The token should be passed in the headers of the request using the following format: "Authorization: token YOUR_CAPTURE_TOKEN"

Header:
Authorization: token $YOUR_CAPTURE_TOKEN (required)
Content-Type: application/json

Request Body (required):
The request body should be a JSON array of commit objects. Each commit object must have the following properties:

assetTreeCid (string): The unique identifier of the associated AssetTree.
timestampCreated (number): The Unix timestamp indicates when the commit was created.


Example 
curl -X POST "https://eoqlryxobmjf9kw.m.pipedream.net" \
     -H "Content-Type: application/json" \
     -H "Authorization: token YOUR_CAPTURE_TOKEN" \
     -d '[{"assetTreeCid":"bafkreiem3uo35xnip52bfg2bx6ghoevibg7t3yupfubxs5amkfnisgeveu", "timestampCreated":1683286764},{"assetTreeCid":"bafkreicoqqvglibw2dxyyopk7xfetiowcs7dy745cjtmbj3bvl7nmmy7di","timestampCreated":1683286945}]'

Response:
Concated AssetTree

200: Cid/Nid retrieved successfully
400: Bad request
401: Unauthorized
403: Forbidden
500: Internal Server Error

Be sure to replace YOUR_CAPTURE_TOKEN with your actual capture token.

In the example request body, two commit objects are being sent. One with assetTreeCid of "bafkreiem3uo35xnip52bfg2bx6ghoevibg7t3yupfubxs5amkfnisgeveu" and timestampCreated of 1683286764, and another with assetTreeCid of "bafkreicoqqvglibw2dxyyopk7xfetiowcs7dy745cjtmbj3bvl7nmmy7di" and timestampCreated of 1683286945.

import requests
import json

url = "https://eoqlryxobmjf9kw.m.pipedream.net"

headers = {
    "Content-Type": "application/json",
    "Authorization": "token YOUR_CAPTURE_TOKEN"  # replace 'YOUR_CAPTURE_TOKEN' with your actual token
}

data = [
    {"assetTreeCid":"bafkreiem3uo35xnip52bfg2bx6ghoevibg7t3yupfubxs5amkfnisgeveu", "timestampCreated":1683286764},
    {"assetTreeCid":"bafkreicoqqvglibw2dxyyopk7xfetiowcs7dy745cjtmbj3bvl7nmmy7di","timestampCreated":1683286945}
]

response = requests.post(url, headers=headers, data=json.dumps(data))

print(response.status_code)
print(response.json())

Last updated