Problem with API

Tim Koschützki's Avatar

Tim Koschützki

03 Apr, 2014 02:16 PM

Hey guys,

when I use your API to get all open discussions, the page parameter does not seem to have any effect. I fetch the first page like so

$ curl -H "Accept: application/vnd.tender-v1+json" \
http://api.tenderapp.com/[[my_site]]/discussions/open?auth=[[auth_key]]&sort=created&page=1

... and it gives me a total: 97 and per_page: 30, so that gives me 4 pages.

$ curl -H "Accept: application/vnd.tender-v1+json" \
http://api.tenderapp.com/[[my_site]]/discussions/open?auth=[[auth_key]]&sort=created&page=2

gives me the exact same result set. :( Likewise for pages 3 and 4.

Also what's weird is that this works:

$ curl -H "Accept: application/vnd.tender-v1+json" \
http://api.tenderapp.com/[[my_site]]/discussions/open?auth=[[auth_key]]&sort=created&page=1

... but this does not:

$ curl -H "Accept: application/vnd.tender-v1+json" \
http://api.tenderapp.com/[[my_site]]/discussions/open?page=1&auth=[[auth_key]]&sort=created

even though it just has "auth" and "page" reversed.

Any ideas?

Kind regards,
Tim

Co-Founder Transloadit
@tim_kos

  1. 1 Posted by Julien on 03 Apr, 2014 04:35 PM

    Julien's Avatar

    Hey Tim,

    I'm taking a look.

  2. 2 Posted by Julien on 03 Apr, 2014 04:45 PM

    Julien's Avatar

    Hi Tim,

    I just tested all these commands, with your API key, on your site, and they all worked as expected. I had the correct result on each page, and the order of parameters had no influence.

    Are you actually using curl, or do you have some code in a different programming language (ruby, php, python, ..)?

    Thanks.

  3. 3 Posted by Tim Koschützki on 03 Apr, 2014 04:54 PM

    Tim Koschützki's Avatar

    Hey there,

    I use this: https://github.com/tim-kos/unreplied_tender_discussions

    I logged the URLs that it uses for each API call and they are the ones I listed.

    Maybe I am missing something?

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  4. 4 Posted by Julien on 03 Apr, 2014 05:16 PM

    Julien's Avatar

    I took a brief look and there is probably something wrong in that lib.

    What exactly are you trying to do? Simply get a list of URLs or integrate this into a node app? If you just want a list of URLs, and you tell me exactly what you need, I can write a single shell command that will give you the result. It will be faster than trying to debug the node module.

  5. 5 Posted by Tim Koschützki on 03 Apr, 2014 06:13 PM

    Tim Koschützki's Avatar

    I would like to get the html_href's of all open discussions that have had 1
    comment so far (as in no reply yet).

  6. 6 Posted by Julien on 03 Apr, 2014 06:47 PM

    Julien's Avatar

    Hey Tim,

    I also noticed that your spam folder is pretty full. Would you like me to empty it for you? It is much easier to deal with spam and false positives with an empty spam folder. In general, we recommend going through your spam folder every day or at least every week, restore any false positive, and delete the rest. This ensures that the spam engine gets trained correctly, and it's much easier to spot false positives inside a small list than a large one.

    So just let me know if you 'd like me to do that for you. I can also delete everything older than X days, if you want to go through the last week manually for example.

    Cheers.

  7. 7 Posted by Julien on 03 Apr, 2014 11:20 PM

    Julien's Avatar

    Hey Tim,

    Using any JSON prettyfier, you could do:

    for page in 1 2 3 4 5 6 7 8 9 10; do
      curl -s -H "Accept: application/vnd.tender-v1+json" \
        "http://api.tenderapp.com/SITE/discussions/new?auth=TOKEN&page=$page" \
        | jsonpp | grep html_href | sed "s/.*\(http.*\)\".*/\1/"
    done
    

    It's unlikely that you would have 10 pages, so you could probably reduce that.

  8. 8 Posted by Tim Koschützki on 04 Apr, 2014 06:06 AM

    Tim Koschützki's Avatar

    Alright, thanks.

    So "new" is the state that I was looking for, that also helps. I'll still try to figure out what's wrong with my lib, but thanks for sharing this.

    This can be closed now.

  9. Julien closed this discussion on 04 Apr, 2014 02:04 PM.

Discussions are closed to public comments.
If you need help with Tender please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac