New PostDetails API endpoint

Issue #30 new
Nils Borrmann created an issue

I just discovered that there is a new API endpoint for getting jodel replies. The old one still works, but the new endpoint gives out some more information (such as "Thanks!"), not all of which I understand.

This is the relevant line from the Android Sourcecode:

    @GET("/v3/posts/{id}/details")
    Observable<PostDetailsResponse> getPostDetails(@Path("id") String str, @Query("highlight") String str2, @Query("details") boolean z, @Query("reply") String str3, @Query("reversed") boolean z2, @Query("origin") String str4);

I dont understand all of these parameters, but @Query("details") needs to be true for the opening post to be included in the response.

Note that the response is formatted a bit different, so it's not a drop-in replacement for the v2 endpoint. Here is a sample response:

{
    "next": null,
    "remaining": 0,
    "readonly": false,
    "shareable": true,
    "replies": [
        {
            "created_at": "2017-03-14T10:50:44.973Z",
            "pin_count": 0,
            "user_handle": "e97be91d3d28d25534c00309a3ab94cdc38eb1c4",
            "got_thanks": false,
            "vote_count": 39,
            "location": {
                "city": "",
                "name": "Oberschlei\u00dfheim",
                "loc_accuracy": 0,
                "country": "",
                "loc_coordinates": {
                    "lng": 0,
                    "lat": 0
                }
            },
            "distance": 8,
            "child_count": 0,
            "color": "DD5F5F",
            "post_own": "friend",
            "message": "Arschloch?!",
            "thanks_count": 0,
            "updated_at": "2017-03-14T10:50:44.973Z",
            "discovered_by": 0,
            "post_id": "58c7cb049bf7b62200334626"
        }
    ],
    "details": {
        "created_at": "2017-03-14T10:50:10.885Z",
        "pin_count": 5,
        "notifications_enabled": false,
        "user_handle": "130fb836a1f4383bad71e4b6606409d10647f6cc",
        "got_thanks": false,
        "vote_count": 28,
        "location": {
            "city": "",
            "name": "M\u00fcnchen",
            "loc_accuracy": 0,
            "country": "",
            "loc_coordinates": {
                "lng": 0,
                "lat": 0
            }
        },
        "distance": 1,
        "child_count": 35,
        "color": "DD5F5F",
        "post_own": "friend",
        "message": "Ist eine gewichtszunahme eures partners ein trennungsgrund? Mein freund meinte er w\u00fcrde schluss machen, wenn ich nicht abnehme, weil er das nicht mehr mit ansehen k\u00f6nne \ud83d\ude22",
        "updated_at": "2017-03-14T11:24:05.515Z",
        "discovered_by": 0,
        "post_id": "58c7cae266d421c02d4948ac",
        "share_count": 0
    }
}

It would be interesting to know what these new parameters mean.

Comments (3)

  1. Nils Borrmann reporter

    They just changed the v2 endpoint. It doesn't show us oj flags anymore. That's only in the v3 version.

  2. Christian Fibich repo owner

    Thanks, I implemented the Endpoint in 8bd0fcb and use it to generate the User Tokens in 30b132f.

    share_count and shareable obviously has something to do with the new share functionality via /posts/{postid}/share (implemented in 5a8cb5e).

  3. Nils Borrmann reporter

    Just looked at your code, some random comments:

    • The v3 endpoint implements paging, via the "reply" parameter and returns only 50 posts at once (look at the next value to get the required parameter). Did you implement that? Not sure, I didn't try it, just looked at the code.
    • The replier parameter isn't available in all jodels. One example would be post_id 58932bfbc195ca1e00c61fb4. Your code might crash if that's the case. In a post like this we need to look at user_handle (possible values: 'oj', 'replier') to get at least the OJ posts
    • The v2 endpoint was changed to also return the oj-flag in user_handle, so it's somewhat useable again. (For about two days the v2 endpoint always returned replier in the user_handle.

    The Jodel API really is a huge mess. They have have three different methods for paging. And you need to use all of them. Stuff randomly doesn't work (there are some jodels where notifications don't work or this "replier" feature.)

    Oh and a fun thing about the v3 endpoint. Its paging parameter is a timestamp. But try to input a timestamp smaller than the oj.created_at, if will return 50 replies starting from the second. You can only get the very first reply by requesting 'next': null.

  4. Log in to comment