Skip to content

Commit 14f679f

Browse files
Offer list and info added
1 parent 76fb919 commit 14f679f

File tree

3 files changed

+410
-2
lines changed

3 files changed

+410
-2
lines changed

api/offers/info.md

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
import Tabs from '@theme/Tabs';
5+
import TabItem from '@theme/TabItem';
6+
import CodeBlock from '@theme/CodeBlock';
7+
import ApiCallExample from '@site/src/components/ApiCallExample';
8+
9+
# Get Offer Information
10+
11+
This endpoint allows you to fetch detailed information about a specific offer.
12+
13+
### Endpoint
14+
15+
<Tabs>
16+
<TabItem value="mainnet" label="Mainnet">
17+
18+
```bash
19+
GET https://api.spacescan.io/offer/HtLDNrF32NzjDSmbub4SYDsHDNBjucVvQvdaBUJBnzjf
20+
```
21+
22+
</TabItem>
23+
<TabItem value="testnet" label="Testnet">
24+
25+
```bash
26+
GET https://api-testnet11.spacescan.io/offer/HtLDNrF32NzjDSmbub4SYDsHDNBjucVvQvdaBUJBnzjf
27+
```
28+
29+
</TabItem>
30+
</Tabs>
31+
32+
### Parameters
33+
34+
| Parameter | Type | Required | Default | Description |
35+
|-----------|------|----------|---------|-------------|
36+
| offer_id | string | Yes | - | The unique identifier of the offer |
37+
38+
### Headers
39+
40+
| Header | Type | Required | Description |
41+
|--------|------|----------|-------------|
42+
| version | string | Yes | API version |
43+
| network | string | Yes | Network identifier (e.g., 'xch' for mainnet) |
44+
45+
:::info Free API
46+
Use `api.spacescan.io` for free tier access. See our [API Plans](https://spacescan.io/apis#plans) for rate limits and features.
47+
:::
48+
49+
:::tip Pro API
50+
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.
51+
52+
```bash
53+
curl -X GET "https://pro-api.spacescan.io/offer/{offer_id}" \
54+
-H "x-api-key: YOUR_API_KEY" \
55+
-H "version: v1" \
56+
-H "network: xch"
57+
```
58+
:::
59+
60+
61+
### Live API Test
62+
63+
<Tabs>
64+
<TabItem value="mainnet" label="Mainnet">
65+
<a href="https://api.spacescan.io/offer/HtLDNrF32NzjDSmbub4SYDsHDNBjucVvQvdaBUJBnzjf" target="_blank" rel="noopener noreferrer" className="api-test-button">
66+
🚀 Test API in Browser
67+
</a>
68+
</TabItem>
69+
</Tabs>
70+
71+
72+
### Request Examples
73+
74+
<Tabs>
75+
<TabItem value="curl" label="cURL">
76+
77+
```bash
78+
curl -X GET "https://api.spacescan.io/offer/HtLDNrF32NzjDSmbub4SYDsHDNBjucVvQvdaBUJBnzjf" \
79+
-H "version: v1" \
80+
-H "network: xch"
81+
```
82+
83+
</TabItem>
84+
<TabItem value="python" label="Python">
85+
86+
```python
87+
import requests
88+
89+
offer_id = "HtLDNrF32NzjDSmbub4SYDsHDNBjucVvQvdaBUJBnzjf"
90+
url = f"https://api.spacescan.io/offer/{offer_id}"
91+
headers = {
92+
"version": "v1",
93+
"network": "xch"
94+
}
95+
96+
response = requests.get(url, headers=headers)
97+
data = response.json()
98+
print(data)
99+
```
100+
101+
</TabItem>
102+
<TabItem value="javascript" label="JavaScript">
103+
104+
```javascript
105+
const offerId = "HtLDNrF32NzjDSmbub4SYDsHDNBjucVvQvdaBUJBnzjf";
106+
const url = `https://api.spacescan.io/offer/${offerId}`;
107+
108+
fetch(url, {
109+
headers: {
110+
"version": "v1",
111+
"network": "xch"
112+
}
113+
})
114+
.then(response => response.json())
115+
.then(data => console.log(data))
116+
.catch(error => console.error('Error:', error));
117+
```
118+
119+
</TabItem>
120+
</Tabs>
121+
122+
### Response Schema
123+
124+
| Field | Type | Description |
125+
|-------|------|-------------|
126+
| status | string | Status of the request ("success" or "failed") |
127+
| data | object | Offer information |
128+
| data.id | string | The unique identifier of the offer |
129+
| data.offer_status | string | Current status of the offer (Active, Pending, Cancelling, Cancelled, Completed, Unknown, Expired) |
130+
| data.offer | string | Raw offer data |
131+
| data.offered | array | Array of assets being offered |
132+
| data.requested | array | Array of assets being requested |
133+
| data.created | string | Timestamp of offer creation |
134+
| data.settled | string | Timestamp when offer was settled |
135+
| data.height | number | Block height of the offer |
136+
137+
#### Asset Object Schema (for offered and requested arrays)
138+
139+
| Field | Type | Description |
140+
|-------|------|-------------|
141+
| type | string | Asset type (NFT1, CAT2, XCH) |
142+
| nft_info | object | NFT information (present if type is NFT1) |
143+
| cat_info | object | CAT information (present if type is CAT1 or CAT2) |
144+
| symbol | string | Asset symbol |
145+
| amount | number | Asset amount |
146+
147+
### Example Response
148+
149+
```json
150+
{
151+
"status": "success",
152+
"data": {
153+
"id": "offer1abc...",
154+
"offer_status": "Active",
155+
"offer": "raw_offer_data",
156+
"offered": [
157+
{
158+
"type": "NFT1",
159+
"nft_info": {
160+
"id": "nft1...",
161+
"name": "Sample NFT",
162+
"preview_url": "https://..."
163+
}
164+
},
165+
{
166+
"type": "CAT2",
167+
"cat_info": {
168+
"asset_id": "cat1...",
169+
"name": "Sample CAT"
170+
},
171+
"symbol": "CAT",
172+
"amount": 100
173+
}
174+
],
175+
"requested": [
176+
{
177+
"type": "XCH",
178+
"symbol": "XCH",
179+
"amount": 1.5
180+
}
181+
],
182+
"created": "2023-01-01T00:00:00Z",
183+
"settled": null,
184+
"height": 1234567
185+
}
186+
}
187+
```
188+
189+
### Error Responses
190+
191+
| HTTP Status Code | Meaning |
192+
|-----------------|---------|
193+
| 401 | Unauthorized -- Missing required headers |
194+
| 404 | Not Found -- The specified offer could not be found |
195+
| 429 | Too Many Requests -- You're requesting too many times |
196+
| 500 | Internal Server Error -- We had a problem with our server |
197+
| 503 | Service Unavailable -- We're temporarily offline for maintenance |

0 commit comments

Comments
 (0)