# 去中心 final API
[TOC]
backend url: https://stormy-temple-44410.herokuapp.com/
## Auth
- `/renew_token/`
- `GET`
- header: JWT: 要有address
- response:
```json=
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZGRyIjoidHoxaEhhbUg0UVJTcUE4TmJ6RThnRTRlY1A2UUV4b0xKdzZKIiwiZXhwIjoxNjUyODU1NzEyfQ.niMlql4EvDwxkTTUJNOtZfy3J5C-mxNL-nhnHM9L23M",
"token_type": "bearer"
}
```
- `/login`
- `POST`
- request:
- address: str(edsigtcoXBaDDappN2bhRfFv3G6bKifBUmZuC2E2WRSPG6xvhf7oXUjiRtgkhc7d8kTkL2T2GoCVmGWtRaNiacbToqtMvEP5Wpy)
- signature: str(tz1hHamH4QRSqA8NbzE8gE4ecP6QExoLJw6J)
- response:
```json=
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZGRyIjoidHoxaEhhbUg0UVJTcUE4TmJ6RThnRTRlY1A2UUV4b0xKdzZKIiwiZXhwIjoxNjUyODU1NzEyfQ.niMlql4EvDwxkTTUJNOtZfy3J5C-mxNL-nhnHM9L23M",
"token_type": "bearer"
}
```
- `/login/{address}/payload`
- `GET`
- response:
```json=
{
"payload": "05010000009554657a6f73205369676e6564204d6573736167653a20436f6e6669726d696e67206d79206964656e7469747920617320747a316848616d48345152537141384e627a4538674534656350365145786f4c4a77364a206f6e2068747470733a2f2f6473722d7465616d2e6769746875622e696f2f2c2074696d653a20323032322d30352d31382030363a31363a35312e313730393039"
}
```
## rooms
- `/rooms/`
- `GET`
- header: JWT: 要有address
- response:
```json
[
{
"name": "col 1",
"image": "http://image",
"owner": "tz1hHamH4QRSqA8NbzE8gE4ecP6QExoLJw6J",
"id": "12ymh7",
"created_at": "2022-05-19T00:56:38.942000",
"updated_at": "2022-05-19T00:56:38.942000"
}
]
```
- `/rooms/create`
- `POST`
- header: JWT: 要有address
- request
```json
{
"name":"test",
"image":"http://example.jpg",
}
```
- response:
```json=
[
{"id": "abc123"}
]
```
- `/rooms/{room_id}/update`
- `PUT`
- header: JWT: 要有address
- request(RAW json not form)
```json
{
"update_dict":{
"name": "update_name", #(optional)
"image": "http://update_img" #(optional)
},
}
```
- response:
```json
{
"name": "col 2",
"image": "http://image.com",
"owner": "tz1hHamH4QRSqA8NbzE8gE4ecP6QExoLJw6J",
"id": "EPUow6",
"created_at": "2022-05-18T23:57:38.503000",
"updated_at": "2022-05-18T23:57:38.503000"
}
```
- `/rooms/{room_id}/delete`
- `DELETE`
- header: JWT: 要有address
- response:
```json
{
"result": "delete success"
}
```
- `/rooms/{room_id}/`
- `GET`
- response:
```json
{
"name": "col 1",
"image": "http://image",
"owner": "tz1hHamH4QRSqA8NbzE8gE4ecP6QExoLJw6J",
"id": "12ymh7",
"metadata":[{},
{"contract":"KT1AFq5XorPduoYyWxs5gEyrFK6fVjJVbtCj",
"tokenId": 8269},{},{},{},{}]
"created_at": "2022-05-19T00:56:38.942000",
"updated_at": "2022-05-19T00:56:38.942000"
}
```
## collections
- `/collections/`
- `GET`
- header: JWT: 要有address
- request:
- offset:(optional)
- mimeTypes:(optional)
- response:
```json=
{
"tokens": [
{
"contract": "KT1AFq5XorPduoYyWxs5gEyrFK6fVjJVbtCj",
"tokenId": 7912,
"creators":[
"tz1Xc8iBaZkvX2XDhMCkkAJ4uy1Puveo26HR"
],
"aliases": [
"Delightening"
],
"name": "《下水NFT藝術獎》恐懼與勇氣",
"description": "面對下水,無論是食入臟器,或是潛入深淵,都擁有需要面對恐懼的勇氣。\n\n參加資格:\n所有《若水NFT藝術獎》的參賽者,皆為評選對象。\n\n主辦單位:Delightening ",
"mimeType": "image/png",
"tags": "[\"Delightening\", \"Likelikewater\", \"underwater2022\"]",
"artifactUri": "https://assets.akaswap.com/ipfs/QmY8GTGfnuRKjyvqvDKUunAibgCUhxpG4y7xv5ayGQx5xg",
"displayUri": "https://assets.akaswap.com/ipfs/QmZeWESxajh7iLZsjL4Qau298y9ZF87oWcQYF6bu6vqx8x",
"thumbnailUri": "https://assets.akaswap.com/ipfs/QmQurnBhyQP6oRTZUm9CopWAjQsiqQBpnrCxFoes9D15Yk"
},
],
"count": 1
}
```
- `/accounts/{address}/nft/`
- `GET`
- request:
- offset:(optional, int): 跳過幾個
- mimeTypes:(optional, str):
Array of strings
Filters tokens by mimeTypes. Supported values: image, gif, video, 3dmodel, interactive, audio, svg, pdf.
- response:
```json=
{
"tokens": [
{
"tokenId": 6797,
"creators": [
"tz1i6vLtcrBbPw8PsfsNqnqjNdy6xyzChiao",
"tz1UY7PqYfnFQoywjS4rzo639UqTUuysBALA"
],
"aliases": [
"",
""
],
"name": "滴水穿石 Like a river carves a canyon",
"description": "世界和平,\n像是遙不可及的龐大議題,\n\n但只要每個人持續地,\n用自己的方式而努力,\n\n就像滴水穿石,\n最終團結的力量終將能改變,\n一起迎接多元色彩的世界吧 !\n\n可以利用滑鼠與作品互動\n\n\nWorld Peace.\nIt seems like a huge, unattainable issue.\n\nBut as long as each person continues to\nIn his or her own way\n\nLike a drop of water penetrating a stone\nIn the end, the power of unity can change.\nLet's welcome the multi-colored world together!\n\n\nYou can interact with the artwork by clicking your mouse.\n",
"mimeType": "application/x-directory",
"tags": [
"LIKEWATER22",
"WORLDPEACE",
"EARTHDAY"
],
"artifactUri": "https://assets.akaswap.com/ipfs/QmXMvo6h5VJfCkLoYALtibscro11DcjN5MTubk9grpy582",
"displayUri": "https://assets.akaswap.com/ipfs/QmVbHWbNXK7nvgQAtoDdkwRhAJBbLmYAK9nRRG2poCqzkq",
"thumbnailUri": "https://assets.akaswap.com/ipfs/QmVbHWbNXK7nvgQAtoDdkwRhAJBbLmYAK9nRRG2poCqzkq",
"latestSoldPrice": 1000000
},
],
"count": 1
}
```
- `/token_metadata/{contract}/{tokenId}`
- `GET`
- response:
```json=
{
"contract": "KT1AFq5XorPduoYyWxs5gEyrFK6fVjJVbtCj",
"tokenId": 6797,
"creators": [
"tz1i6vLtcrBbPw8PsfsNqnqjNdy6xyzChiao",
"tz1UY7PqYfnFQoywjS4rzo639UqTUuysBALA"
],
"name": "滴水穿石 Like a river carves a canyon",
"description": "世界和平,\n像是遙不可及的龐大議題,\n\n但只要每個人持續地,\n用自己的方式而努力,\n\n就像滴水穿石,\n最終團結的力量終將能改變,\n一起迎接多元色彩的世界吧 !\n\n可以利用滑鼠與作品互動\n\n\nWorld Peace.\nIt seems like a huge, unattainable issue.\n\nBut as long as each person continues to\nIn his or her own way\n\nLike a drop of water penetrating a stone\nIn the end, the power of unity can change.\nLet's welcome the multi-colored world together!\n\n\nYou can interact with the artwork by clicking your mouse.\n",
"mimeType": "application/x-directory",
"tags": [
"LIKEWATER22",
"WORLDPEACE",
"EARTHDAY"
],
"artifactUri": "https://assets.akaswap.com/ipfs/QmXMvo6h5VJfCkLoYALtibscro11DcjN5MTubk9grpy582",
"displayUri": "https://assets.akaswap.com/ipfs/QmVbHWbNXK7nvgQAtoDdkwRhAJBbLmYAK9nRRG2poCqzkq",
"thumbnailUri": "https://assets.akaswap.com/ipfs/QmVbHWbNXK7nvgQAtoDdkwRhAJBbLmYAK9nRRG2poCqzkq",
"latestSoldPrice": 1.0
}
```