Rest API

We have a rest endpoint for our GraphQL API. It currently only supports data fetching.

We ported over some of our GraphQL endpoints to REST using https://www.sofa-api.com/. All responses are flattened out and we apologize if the formatting / syntax is off as this was easiest way for us to not have to write separate REST endpoints. The inputs unlike the graphql server are snake case. Request to the rest endpoints will all be POST requests.

API Key

An api key is still required for our rest endpoint to track usage. The API key is expected to be header of the request:

Authorization: API_KEY

REST Endpoint

https://beta.api.solanalysis.com/rest

Current Supported Paths / APIs

/get-project-stats
- Fetches stats for projects and information, 
  - attributes, marketcap, volume, floor, avg price, etc

/get-project-stat-by-name
- Fetches project stat by name, used as a search as we have our own internal slug for projects

/get-market-place-snapshots
- Fetches token level information, attributes, where it's listed if it is, name, image

/get-project-stat-hist
- Fetches historical stats for a project, time granularity in 24H or 1H
 
/get-market-place-status
- Fetches market places information, the display name or site for a specific program

/get-token-state
- Fetches the live order book of a token

/get-market-place-actions-by-token
- Fetches marketplace history for a token

/get-wallet-stats
- Fetches wallet stats leaderboard

/get-wallet-stats-hist
- Fetches wallet stat for an address (rough est. of port value if exists)

Get Project Stats

Details on the inputs and responses found here Projects & Stats

Getting project stats order by market cap

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-project-stats"

payload = json.dumps({
  "order_by": {
    "field_name": "market_cap",
    "sort_order": "DESC"
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-project-stats' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_by": {
        "field_name": "market_cap",
        "sort_order": "DESC"
    }
}'

Getting a specific project

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-project-stats"

payload = json.dumps({
  "conditions": {
    "project_ids": [
      "degods"
    ]
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-project-stats' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "conditions": {
        "project_ids": ["degods"]
    }
}'

Get Project Stats By Name

Searching project stats by display name

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-project-stat-by-name"

payload = json.dumps({
  "condition": {
    "display_name": "degen"
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)



//CURL


curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-project-stat-by-name' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "condition": {
        "display_name": "degen"
    }
}'

Get Project Stat Hist

Getting historical stats. See Historical Statsfor a detailed information on the inputs and responses.

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-project-stat-hist"

payload = json.dumps({
  "conditions": {
    "project_ids": [
      "fractals"
    ],
    "start_timestamp": 1641128400,
    "end_timestamp": 1641158340,
    "time_granularity": "PER_HOUR"
  },
  "pagination_info": {
    "page_number": 1,
    "page_size": 5
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-project-stat-hist' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "conditions": {
      "project_ids": ["fractals"],
      "start_timestamp": 1641128400,
      "end_timestamp": 1641158340,
      "time_granularity": "PER_HOUR"
    },
  "pagination_info": {
    "page_number": 1,
    "page_size": 5
  }
}'

Get Market Place Status

Gets information regarding a market place. Use this to tie their program/instance ids to their display name, website, etc. See Marketplace Statusfor more details on the response.

import requests

url = "https://beta.api.solanalysis.com/rest/get-market-place-status"

payload = ""
headers = {
  'Authorization': API_KEY
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-market-place-status' \
--header 'Authorization: API_KEY' \
--data-raw ''

Get Market Place Snapshot

The core of our token information. Contains all information for a token: project slug, attributes, display name, and where it is listed / highest bid. See Marketplace Snapshot for more details on the response.

Show recently listed degods

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-market-place-snapshots"

payload = json.dumps({
  "condition": {
    "project_ids": [
      {
        "project_id": "degods"
      }
    ]
  },
  "order_by": {
    "field_name": "lowest_listing_block_timestamp",
    "sort_order": "DESC"
  },
  "pagination_info": {
    "page_number": 1
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


// CURL 

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-market-place-snapshots' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "condition": {
      "project_ids": [{"project_id": "degods"}]
    },
  "order_by": {
      "field_name": "lowest_listing_block_timestamp",
      "sort_order": "DESC"
  },
  "pagination_info": {
    "page_number": 1
  }
}'

Show lowest listed degods

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-market-place-snapshots"

payload = json.dumps({
  "condition": {
    "project_ids": [
      {
        "project_id": "degods",
        "attributes": [
          {
            "name": "version",
            "type": "CATEGORY",
            "values": [
              "DeadGod"
            ]
          }
        ]
      }
    ]
  },
  "order_by": {
    "field_name": "lowest_listing_block_timestamp",
    "sort_order": "DESC"
  },
  "pagination_info": {
    "page_number": 1
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-market-place-snapshots' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "condition": {
      "project_ids": [{"project_id": "degods", "attributes": [{"name": "version", "type": "CATEGORY", "values": ["DeadGod"]}]}]
    },
  "order_by": {
      "field_name": "lowest_listing_block_timestamp",
      "sort_order": "DESC"
  },
  "pagination_info": {
    "page_number": 1
  }
}'

Get 1 attribute SMBS

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-market-place-snapshots"

payload = json.dumps({
  "condition": {
    "project_ids": [
      {
        "project_id": "smb",
        "attributes": [
          {
            "name": "Attributes Count",
            "type": "NUMERIC",
            "values": [
              "1"
            ]
          }
        ]
      }
    ]
  },
  "order_by": {
    "field_name": "lowest_listing_block_timestamp",
    "sort_order": "DESC"
  },
  "pagination_info": {
    "page_number": 1
  }
})
headers = {
  'Authorization': API_KEY,
  'Contentzs-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-market-place-snapshots' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "condition": {
        "project_ids": [
            {
                "project_id": "smb",
                "attributes": [
                    {
                        "name": "Attributes Count",
                        "type": "NUMERIC",
                        "values": [
                            "1"
                        ]
                    }
                ]
            }
        ]
    },
    "order_by": {
        "field_name": "lowest_listing_block_timestamp",
        "sort_order": "DESC"
    },
    "pagination_info": {
        "page_number": 1
    }
}'

Get Token State & Get Marketplace Actions by Token

Reference Token State & Token History

Get token state for FUsGSgD9sdnHugRCWHhoxLnyER4mwL7wcEYLyaz5zw66

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-token-state"

payload = json.dumps({
  "condition": {
    "token_addresses": [
      "FUsGSgD9sdnHugRCWHhoxLnyER4mwL7wcEYLyaz5zw66"
    ]
  },
  "pagination_info": {
    "page_number": 1
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-token-state' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "condition": {
        "token_addresses": ["FUsGSgD9sdnHugRCWHhoxLnyER4mwL7wcEYLyaz5zw66"]
    },
    "pagination_info": {
        "page_number": 1
    }
}'

Get token history for FUsGSgD9sdnHugRCWHhoxLnyER4mwL7wcEYLyaz5zw66

import requests
import json

url = "https://beta.api.solanalysis.com/rest/get-market-place-actions-by-token"

payload = json.dumps({
  "condition": {
    "token_addresses": [
      "FUsGSgD9sdnHugRCWHhoxLnyER4mwL7wcEYLyaz5zw66"
    ]
  },
  "pagination_info": {
    "page_number": 1
  }
})
headers = {
  'Authorization': API_KEY,
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)



// CURL

curl --location --request POST 'https://beta.api.solanalysis.com/rest/get-market-place-actions-by-token' \
--header 'Authorization: API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "condition": {
        "token_addresses": ["FUsGSgD9sdnHugRCWHhoxLnyER4mwL7wcEYLyaz5zw66"]
    },
    "pagination_info": {
        "page_number": 1
    }
}'

Last updated