Skip to content

Commit

Permalink
Merge pull request #156 from spacescan-io/sabari
Browse files Browse the repository at this point in the history
Added new changes
  • Loading branch information
natsabari authored Dec 1, 2024
2 parents 5de1dc4 + 6d42ce0 commit 40a9a10
Show file tree
Hide file tree
Showing 12 changed files with 1,896 additions and 1,076 deletions.
171 changes: 171 additions & 0 deletions api/did/info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
---
sidebar_position: 1
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import CodeBlock from '@theme/CodeBlock';
import ApiCallExample from '@site/src/components/ApiCallExample';

# Get DID Information

This endpoint allows you to fetch detailed information about a specific DID (Decentralized Identifier).

### Endpoint

<Tabs>
<TabItem value="mainnet" label="Mainnet">

```
GET https://api.spacescan.io/did/info/{did}
```

</TabItem>
<TabItem value="testnet" label="Testnet">

```
GET https://api-testnet11.spacescan.io/did/info/{did}
```

</TabItem>
</Tabs>

### Parameters

| Parameter | Type | Description |
|-----------|--------|-------------------------------------------------|
| did | string | The Decentralized Identifier (DID) |

:::info Free API
Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacescan.io/apis#plans) for rate limits and features.
:::

:::tip Pro API
Use `pro-api.spacescan.io` with your API key in the `x-api-key` header. See our [API Plans](https://spacescan.io/apis#plans) for details.

```bash
curl -X GET "https://pro-api.spacescan.io/did/info/{did}" \
-H "x-api-key: YOUR_API_KEY"
```
:::

### Live API Test

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<a href="https://api.spacescan.io/did/info/did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
<TabItem value="testnet" label="Testnet">
<a href="https://api-testnet11.spacescan.io/did/info/did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2" target="_blank" rel="noopener noreferrer" className="api-test-button">
🚀 Test API in Browser
</a>
</TabItem>
</Tabs>

### Request Example

<Tabs>
<TabItem value="curl" label="cURL">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="bash">
curl -X GET "https://api.spacescan.io/did/info/did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2"
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="bash">
curl -X GET "https://api-testnet11.spacescan.io/did/info/did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2"
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
<TabItem value="python" label="Python">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="python">
import requests

did = "did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2"
url = f"https://api.spacescan.io/did/info/{did}"

response = requests.get(url)
data = response.json()
print(data)
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="python">
import requests

did = "did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2"
url = f"https://api-testnet11.spacescan.io/did/info/{did}"

response = requests.get(url)
data = response.json()
print(data)
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
<TabItem value="javascript" label="JavaScript">
<Tabs>
<TabItem value="mainnet" label="Mainnet">
<CodeBlock language="javascript">
const did = "did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2";
const url = `https://api.spacescan.io/did/info/${did}`;

fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
</CodeBlock>
</TabItem>
<TabItem value="testnet" label="Testnet">
<CodeBlock language="javascript">
const did = "did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2";
const url = `https://api-testnet11.spacescan.io/did/info/${did}`;

fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
</CodeBlock>
</TabItem>
</Tabs>
</TabItem>
</Tabs>

### Response

<Tabs>
<TabItem value="mainnet" label="Mainnet">
<ApiCallExample endpoint="https://api.spacescan.io/did/info/did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2" />
</TabItem>
<TabItem value="testnet" label="Testnet">
<ApiCallExample endpoint="https://api-testnet11.spacescan.io/did/info/did:chia:19qf3g9876t0rkq7tfdkc28cxfy424yzanea29rkzylq89kped9hq3q7wd2" />
</TabItem>
</Tabs>

### Response Schema

| Field | Type | Description |
|-------------------------|---------|-------------------------------------------------------|
| status | string | The status of the API request |
| data | object | The main data object |
| data.did | object | DID information |
| data.did.did | string | The DID identifier |
| data.did.did_hex | string | Hexadecimal representation of the DID |
| data.name | string | Name associated with the DID |
| data.name_nft_id | string | NFT ID associated with the name (if any) |
| data.name_service | string | Name service information |
| data.expiry | string | Expiration date (if applicable) |
| data.profile_url | string | URL to the profile image |
| data.banner_url | string | URL to the banner image |
| data.flagged | boolean | Whether the DID has been flagged |
| data.social | object | Social media information |
| data.bio | string | Biography or description |
| data.collections_count | string | Number of NFT collections |
| data.created_nft_count | string | Number of NFTs created |
| data.owned_nft_count | number | Number of NFTs owned |
```
8 changes: 7 additions & 1 deletion apisidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,14 @@ const sidebars = {
'collection/info',
],
},
{
type: 'category',
label: 'DID',
items: [
'did/info',
],
},
'data_layer',
'did',
'mempool',
'coins',
'block',
Expand Down
Loading

0 comments on commit 40a9a10

Please sign in to comment.