Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only getting unread items from API #1863

Closed
ghost opened this issue Apr 5, 2016 · 4 comments
Closed

Only getting unread items from API #1863

ghost opened this issue Apr 5, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 5, 2016

Issue details

When I'm trying to fetch all items during initialization of my app, wallabag doesn't return even one of them. The joke is that there are 240 items in the database. Additional parameters like archive or starred didn't help.

HTTP request

GET https://wallabag.jlnostr.de/api/entries.json HTTP/1.1
Accept-Encoding: gzip, deflate
User-Agent: (wallabag for Windows)
Authorization: Bearer YzRhZjFhNjBhMTJjZjEwZGIzNTg3NTg0ZmY2MDFlNWYxM2I3ZTE0NTJlMmQxMzU5OGViZDk2YmJkN2YzYzU5NA
Host: wallabag.jlnostr.de
Connection: Keep-Alive

HTTP response

HTTP/1.1 200 OK
Date: Tue, 05 Apr 2016 14:02:15 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.5.10
0: application/json
Cache-Control: no-cache
Set-Cookie: PHPSESSID=6rqig130e77s3s8rabso05okt3; path=/; HttpOnly
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json

{"page":1,"limit":30,"pages":1,"total":0,"_links":{"self":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"},"first":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"},"last":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"}},"_embedded":{"items":[]}}

Environment

  • wallabag version (or git revision) that exhibits the issue: 2.0.0
  • How did you install wallabag? Via composer create-project or by downloading the package?
  • Last wallabag version that did not exhibit the issue (if applicable): 2.0.0-beta2 not known
  • php version: 5.5.10
  • OS: CentOS
  • type of hosting (shared or dedicated): shared
  • which storage system you choose at install (SQLite, MySQL/MariaDB or PostgreSQL): SQLite
@ghost ghost added the Bug label Apr 5, 2016
@ghost
Copy link
Author

ghost commented Apr 5, 2016

Okay, the API is only returning unread articles, no matter what parameters are set (tried it with starred).

HTTP request

GET https://wallabag.jlnostr.de/api/entries.json HTTP/1.1
Accept-Encoding: gzip, deflate
User-Agent: (wallabag for Windows)
Authorization: Bearer MjFkYTBkZGMyNDY0NDU1OGQwZGEyZWE4ZjM0YTczNWQwODZhNjAzYzc4YzA4OTQ3OGY0YjVjYTZjNDM4ODQ1Ng
Content-Length: 13
Content-Type: application/json; charset=UTF-8
Host: wallabag.jlnostr.de
Connection: Keep-Alive
Cache-Control: no-cache

{"starred":1}

HTTP response

HTTP/1.1 200 OK
Date: Tue, 05 Apr 2016 14:20:51 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.5.10
0: application/json
Cache-Control: no-cache
Set-Cookie: PHPSESSID=tgecnkkasl019abt1ahvkdonj1; path=/; HttpOnly
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json

{"page":1,"limit":30,"pages":1,"total":1,"_links":{"self":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"},"first":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"},"last":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"}},"_embedded":{"items":[{"is_archived":0,"is_starred":0,"user_name":"wallabag","user_email":"","user_id":1,"id":241,"title":"Ebook Reader App","url":"https:\/\/dribbble.com\/shots\/2361400-Ebook-Reader-App","content":"<noscript readability=\"4\">\n  <h4>JavaScript Not Enabled<\/h4>\n  <p class=\"note\">Uploading an attachment requires the use of JavaScript. If you'd like to upload an attachment, please enable JavaScript in your browser and refresh this page.<\/p>\n<\/noscript>\n<div class=\"attachments\">\n  <h3>1 Attachment<\/h3>\n    <ul class=\"thumbs larger group\"><li id=\"attachment-452679\" class=\" \" data-screenshot-id=\"2361400\" data-attachment-id=\"452679\">\n      <a data-title=\"Dribbble - ebook_reader_2x.png by Jakov\" href=\"https:\/\/dribbble.com\/shots\/2361400-Ebook-Reader-App\/attachments\/452679\">\n          <img class=\"thumb\" title=\"ebook_reader_2x.png\" src=\"https:\/\/d13yacurqjgara.cloudfront.net\/users\/244753\/screenshots\/2361400\/attachments\/452679\/thumbnail\/ebook_reader_2x.png\" alt=\"Ebook reader 2x\"\/><\/a>\n  <\/li>\n    <\/ul><\/div>\n      ","created_at":"2016-04-05T16:19:55+0200","updated_at":"2016-04-05T16:19:55+0200","annotations":[],"mimetype":"text\/html","language":"en","reading_time":0,"domain_name":"dribbble.com","preview_picture":"https:\/\/d13yacurqjgara.cloudfront.net\/users\/244753\/screenshots\/2361400\/ebook_reader.png","tags":[],"_links":{"self":{"href":"\/api\/entries\/241"}}}]}}

@ghost ghost changed the title [API] Not getting any items Only getting unread items from API Apr 5, 2016
@nicosomb nicosomb added this to the 2.0.1 milestone Apr 5, 2016
@j0k3r
Copy link
Member

j0k3r commented Apr 5, 2016

What if you do GET https://wallabag.jlnostr.de/api/entries.json?starred=1 HTTP/1.1 ?

@ghost
Copy link
Author

ghost commented Apr 5, 2016

Also not working.

HTTP/1.1 200 OK
Date: Tue, 05 Apr 2016 15:12:01 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.5.10
0: application/json
Cache-Control: no-cache
Set-Cookie: PHPSESSID=c6rh6s0urbp4b7mun1m5i93n56; path=/; HttpOnly
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json

{"page":1,"limit":30,"pages":1,"total":0,"_links":{"self":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"},"first":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"},"last":{"href":"https:\/\/wallabag.jlnostr.de\/api\/entries?page=1&perPage=30"}},"_embedded":{"items":[]}}

@nicosomb
Copy link
Member

nicosomb commented Apr 5, 2016

In fact, if you put starred=1, the API adds archived=0, because we cast isArchived to boolean.

If we don't pass archived, wallabag runs this query:

SELECT e FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user =:userId AND e.isArchived =:isArchived AND e.isStarred =:isStarred

We need to test if we pass filters to the API method. If not, we have to set null to findEntries (repository method).

I don't know if I'm clear.

@nicosomb nicosomb self-assigned this Apr 9, 2016
nicosomb added a commit that referenced this issue Apr 9, 2016
Fix #1863: only the unread entries were fetched with GET /api/entries entrypoint. Now, all the entries are fetched
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants