Rest-API: First call with different structure
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 354
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 43
Description
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Describe the bug
TL;DR:
With a fresh Deck installation, if you call the get boards endpoint, the very first call is differently structured than described in the API documentation.
Details:
Thanks @Aruscha for finding and investigating this issue.
He installed the Deck Android app and just connected the account as usual. With the first sync, the app crashes because of invalid data from the server. After several tests we found out that the first response to the boards call looks like this:
{
"1": {
"title": "Persönlich",
"owner": {
"primaryKey": "admin",
"uid": "admin",
"displayname": "admin",
"type": 0
},
"color": "0087C5",
"archived": false,
"labels": [
{
"title": "Abgeschlossen",
"color": "31CC7C",
"boardId": 1,
"cardId": null,
"lastModified": 1627986420,
"id": 1,
"ETag": "c6bddc9dec21b630436527323bd3e042"
},
],
"acl": [],
"permissions": {
"PERMISSION_READ": true,
"PERMISSION_EDIT": true,
"PERMISSION_MANAGE": true,
"PERMISSION_SHARE": true
},
"users": [
{
"primaryKey": "admin",
"uid": "admin",
"displayname": "admin",
"type": 0
}
],
"stacks": [],
"deletedAt": 0,
"lastModified": 1627986420,
"settings": {
"notify-due": "assigned",
"calendar": true
},
"id": 1,
"ETag": "c6bddc9dec21b630436527323bd3e042"
}
}
The relevant part is This one:
{
"1": {
While any subsequent call returns the expected structure:
[
{
"title": "Pers\u00f6nlich",
"owner": {
"primaryKey": "admin",
"uid": "admin",
"displayname": "admin",
"type": 0
},
"color": "0087C5",
"archived": false,
"labels": [],
"acl": [],
"permissions": {
"PERMISSION_READ": true,
"PERMISSION_EDIT": true,
"PERMISSION_MANAGE": true,
"PERMISSION_SHARE": true
},
"users": [],
"shared": 0,
"stacks": [],
"deletedAt": 0,
"lastModified": 1627989575,
"settings": {
"notify-due": "assigned",
"calendar": true
},
"id": 1,
"ETag": "16cb6cd5ce8936d054408c382dc4f655"
}
]
Starting with:
[
{
"title": "Pers\u00f6nlich",
To Reproduce
Steps to reproduce the behavior:
- Fresh install Deck app on Server side
curl -X GET 'https://user:passwort@domainOrIP/index.php/apps/deck/api/v1.0/boards' -H 'Accept: application/json' -H 'OCS-APIRequest: true' -H 'Content-Type: application/json;charset=utf-8'- see response, as mentioned above
- without changing anything, just again run the same
curl - see different response, as mentioned above
Expected behavior
The first call should behave like the second one
Client details:
- Android, but works with any
- none, curl, plain HTTP
- Server App Version: 1.4.3
Android Client details
- OS Version: 4.9.274-Zeus-Thunder-v4.0-libperfmgr-gb00a9e1e(23)
- OS API Level: 30
- Device: dipper
- Manufacturer: Xiaomi
- Model (and Product): MI 8 (dipper)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the first and repeated GET requests to the /index.php/apps/deck/api/v1.0/boards endpoint on a fresh Deck installation with the provided curl command. Trace the boards API response handling and compare both responses with the documented array structure; done means the first call has the same structure as subsequent calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100