You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: deso-backend/api/dao-endpoints.md
+34-37
Original file line number
Diff line number
Diff line change
@@ -11,34 +11,27 @@ description: >-
11
11
\
12
12
For endpoints to check ownership of DeSo Tokens, see [#get-hodlers-for-public-key](social-endpoints.md#get-hodlers-for-public-key"mention") and [#is-hodling-public-key](social-endpoints.md#is-hodling-public-key"mention").
13
13
14
-
{% swagger method="post" path="" baseUrl="/api/v0/get-dao-coin-limit-orders" summary="Gets All Open Orders on Order Book for a DeSo Token (DAO Coin) Market" %}
15
-
{% swagger-description %}
14
+
## Gets All Open Orders on Order Book for a DeSo Token (DAO Coin) Market
There are two types of markets where DeSo Tokens can be traded on the on-chain order book exchange: 1) markets where a DeSo Token is traded for $DESO, and 2) markets where a DeSo Token is traded for another DeSo Token.
17
19
18
20
This endpoint returns all open orders given two coins that can be traded against each other. At least one of the two coins must be a DeSo Token.
19
21
20
22
See [#create-dao-coin-limit-order](../construct-transactions/dao-transactions-api.md#create-dao-coin-limit-order"mention") for how to create new limit orders to trade DeSo Tokens.
21
23
22
24
Endpoint implementation in [backend](https://github.com/deso-protocol/backend/blob/0af8093227b219de31487ac129e799fee61e39ef/routes/dao\_coin\_exchange.go#L37).
| DAOCoin2CreatorPublicKeyBase58CheckOrUsername2<markstyle="color:red;">\*</mark> | string | <p>Public key or username of the creator of the DAO, whose DeSo Token makes up the second side of the market.</p><p></p><p>An empty string here represents $DESO as the second side of the market.</p> |
31
+
| DAOCoin1CreatorPublicKeyBase58CheckOrUsername<markstyle="color:red;">\*</mark> | string | <p>Public key or username of the creator of the Token, whose DeSo Token makes up one side of a market.</p><p></p><p>An empty string here represents $DESO as one side of the market.</p> |
36
32
37
-
38
-
An empty string here represents $DESO as the second side of the market.
39
-
{% endswagger-parameter %}
40
-
41
-
{% swagger-response status="200: OK" description="Successfully retrieved all open orders for a coin pair" %}
33
+
{% tabs %}
34
+
{% tab title="200: OK Successfully retrieved all open orders for a coin pair" %}
42
35
{% tabs %}
43
36
{% tab title="Sample Response" %}
44
37
```json5
@@ -69,37 +62,41 @@ An empty string here represents $DESO as the second side of the market.
69
62
```
70
63
{% endtab %}
71
64
{% endtabs %}
72
-
{% endswagger-response %}
65
+
{% endtab %}
73
66
74
-
{% swagger-response status="400: Bad Request" description="" %}
67
+
{% tab title="400: Bad Request" %}
75
68
```javascript
76
69
{
77
70
"error":"..."// Error message
78
71
}
79
72
```
80
-
{% endswagger-response %}
73
+
{% endtab %}
81
74
82
-
{% swagger-response status="500: Internal Server Error" description="" %}
75
+
{% tab title="500: Internal Server Error" %}
83
76
```javascript
84
77
{
85
78
"error":"..."// Error message
86
79
}
87
80
```
88
-
{% endswagger-response %}
89
-
{% endswagger %}
81
+
{% endtab %}
82
+
{% endtabs %}
83
+
84
+
## Gets All Open Limit Orders Created by a Transactor
{% swagger method="post" path="" baseUrl="/api/v0/get-transactor-dao-coin-limit-orders" summary="Gets All Open Limit Orders Created by a Transactor" %}
92
-
{% swagger-description %}
93
88
This endpoint returns all open orders that were created by a given transactor on the DeSo Tokens on-chain order book exchange.
94
89
95
90
Endpoint implementation in [backend](https://github.com/deso-protocol/backend/blob/0af8093227b219de31487ac129e799fee61e39ef/routes/dao\_coin\_exchange.go#L136).
| TransactorPublicKeyBase58CheckOrUsername<markstyle="color:red;">\*</mark> | string | Public key or username of the user whose open orders we want to retrieve. |
101
97
102
-
{% swagger-response status="200: OK" description="Successfully retrieved all open orders for the transactor" %}
98
+
{% tabs %}
99
+
{% tab title="200: OK Successfully retrieved all open orders for the transactor" %}
103
100
{% tabs %}
104
101
{% tab title="Sample Response" %}
105
102
```json5
@@ -120,21 +117,21 @@ Public key or username of the user whose open orders we want to retrieve.
120
117
```
121
118
{% endtab %}
122
119
{% endtabs %}
123
-
{% endswagger-response %}
120
+
{% endtab %}
124
121
125
-
{% swagger-response status="400: Bad Request" description="" %}
122
+
{% tab title="400: Bad Request" %}
126
123
```javascript
127
124
{
128
125
"error":"..."// Error message
129
126
}
130
127
```
131
-
{% endswagger-response %}
128
+
{% endtab %}
132
129
133
-
{% swagger-response status="500: Internal Server Error" description="" %}
Uploads an image to be included in a post and returns the URL where the image is stored. This endpoint also handles the resizing of the image.
12
14
13
15
Note that the request body should have `multipart/form-data` as the content type.
@@ -17,21 +19,17 @@ Endpoint implementation in [backend](https://github.com/deso-protocol/backend/bl
17
19
Example usages in frontend:\
18
20
 \- Make request to [Upload Image](https://github.com/deso-protocol/frontend/blob/e006beb72867f6d48a78adb1d126c66144a4298c/src/app/backend-api.service.ts#L825)\
19
21
 \- Use UploadImage to [upload an image when a user is making a post](https://github.com/deso-protocol/frontend/blob/e006beb72867f6d48a78adb1d126c66144a4298c/src/app/feed/feed-create-post/feed-create-post.component.ts#L279)
UploadVideo creates a one-time tokenized URL that can be used to upload larger video files using the tus protocol. The client uses the Location header in the response from this function to upload the file. The client uses the Stream-Media-Id header in the response from cloudflare to understand how to access the file for streaming. 
64
64
65
65
For more details, see the Cloudflare documentation on direct creator uploads [here](https://developers.cloudflare.com/stream/uploading-videos/direct-creator-uploads#using-tus-recommended-for-videos-over-200mb)
@@ -69,53 +69,48 @@ Endpoint implementation in [backend](https://github.com/deso-protocol/backend/bl
69
69
For an example of uploading a video using this endpoint and the tus protocol, see the [implementation in frontend](https://github.com/deso-protocol/frontend/blob/e006beb72867f6d48a78adb1d126c66144a4298c/src/app/feed/feed-create-post/feed-create-post.component.ts#L291).\
70
70
\
71
71
After the upload finishes, you can check if the video is ready to be streamed by hitting the [#get-video-status](media-endpoints.md#get-video-status"mention")endpoint
[cloudflare documentation for more details](https://developers.cloudflare.com/stream/uploading-videos/upload-video-file#supported-options-in-upload-metadata)
| Upload-Length<markstyle="color:red;">\*</mark> | Number | Length of video to be uploaded in bytes |
78
+
| Upload-Metadata | JSON | Arbitrary metadata values - see [cloudflare documentation for more details](https://developers.cloudflare.com/stream/uploading-videos/upload-video-file#supported-options-in-upload-metadata)|
85
79
86
-
{% swagger-response status="200: OK" description="Successfully created one-time tokenized URL that can be used to upload a video" %}
80
+
{% tabs %}
81
+
{% tab title="200: OK Successfully created one-time tokenized URL that can be used to upload a video" %}
87
82
The Location header specifies the one-time tokenized URL. The Stream-Media-Id header is the ID used to stream the video from cloudflare after uploading the video.
88
-
{% endswagger-response %}
83
+
{% endtab %}
89
84
90
-
{% swagger-response status="400: Bad Request" description="" %}
{% swagger method="get" path="" baseUrl="/api/v0/get-video-status/{videoId}" summary="Get Video Status" %}
100
-
{% swagger-description %}
101
98
Get Video Status queries cloudflare's API to see if a video is ready to be streamed. This is useful in showing a preview of an uploaded video to an end-user when they are creating a post.
102
99
103
100
Endpoint implementation in [backend](https://github.com/deso-protocol/backend/blob/709cbfbc62cf3a0e6d56c393e555fc277c93fb76/routes/media.go#L372).
104
101
105
102
Example usage in frontend:\
106
103
 \- Make request to [Get Video Status](https://github.com/deso-protocol/frontend/blob/e006beb72867f6d48a78adb1d126c66144a4298c/src/app/backend-api.service.ts#L2228)\
107
104
 \- Use GetVideoStatus to [poll and see if a video is ready to be streamed after a user finished uploading it.](https://github.com/deso-protocol/frontend/blob/e006beb72867f6d48a78adb1d126c66144a4298c/src/lib/services/stream/cloudflare-stream-service.ts#L31)
{% swagger method="post" path="" baseUrl="/api/v0/get-full-tiktok-url" summary="Get Full TikTok URL" %}
146
-
{% swagger-description %}
147
144
Given a short video ID of a TikTok, find the URL that can be used to embed this video. The short URL users get when copying a link to a TikTok from TikTok's mobile app isn't embeddable, so this endpoint allows us to find the desktop version of the URL from which we can construct an embeddable version of the URL.
148
145
149
146
Endpoint implementation in [backend](https://github.com/deso-protocol/backend/blob/709cbfbc62cf3a0e6d56c393e555fc277c93fb76/routes/media.go#L244).
150
147
151
148
Example usages in frontend:\
152
149
 \- Make request to [Get Full TikTok URL](https://github.com/deso-protocol/frontend/blob/e006beb72867f6d48a78adb1d126c66144a4298c/src/app/backend-api.service.ts#L1962)\
153
150
 \- Use GetFullTikTokURL to [get an embeddable URL for the short form TikTok url](https://github.com/deso-protocol/frontend/blob/e006beb72867f6d48a78adb1d126c66144a4298c/src/lib/services/embed-url-parser-service/embed-url-parser-service.ts#L147)
| TikTokShortVideoID<markstyle="color:red;">\*</mark> | String | <p>Video ID found at the end of a URL copied from the TikTok mobile app. </p><p></p><p>For example, <code>TTPd2Eobq3</code> is the VideoID in https://vm.tiktok.com/TTPd2Eobq3/`</p> |
160
157
161
-
For example, `TTPd2Eobq3` is the VideoID in https://vm.tiktok.com/TTPd2Eobq3/\`
162
-
{% endswagger-parameter %}
163
-
164
-
{% swagger-response status="200: OK" description="Successfully retrieved the embeddable version of the mobile TikTok URL provided" %}
158
+
{% tabs %}
159
+
{% tab title="200: OK Successfully retrieved the embeddable version of the mobile TikTok URL provided" %}
165
160
{% tabs %}
166
161
{% tab title="Sample Response" %}
167
162
```json5
@@ -177,13 +172,13 @@ For example, `TTPd2Eobq3` is the VideoID in https://vm.tiktok.com/TTPd2Eobq3/\`
177
172
| FullTikTokURL | String | Desktop version of the mobile TikTok URL provided in the request body that can be embedded in a post |
178
173
{% endtab %}
179
174
{% endtabs %}
180
-
{% endswagger-response %}
175
+
{% endtab %}
181
176
182
-
{% swagger-response status="400: Bad Request" description="" %}
0 commit comments