Using MM 5.26.1
, I'm performing the following commands which work:
$ curl -i -d '{"login_id":"mihai","password":"bCsTx6GZZAAAAAA"}' http://localhost:8065/api/v4/users/login
# now have a token which I can use for subsequent queries
$ curl -i -H 'Authorization: Bearer 4jymwea6btbqmre61wx6XXXXXX' http://localhost:8065/api/v4/channels
...
{
"id": "y4srrjqzoj8aunnnakb8px79eo",
"create_at": 1603220311102,
"update_at": 1603220311102,
"delete_at": 0,
"team_id": "iax6hqhw7idkidbs5rz4mi4skr",
"type": "O",
"display_name": "Town Square",
"name": "town-square",
"header": "",
"purpose": "",
"last_post_at": 1603220326473,
"total_msg_count": 1,
"extra_update_at": 0,
"creator_id": "",
"scheme_id": null,
"props": null,
"group_constrained": null,
"team_display_name": "foo",
"team_name": "foo",
"team_update_at": 1603220311101
}
Beautiful. Now I would like to retrieve the posts for town-square
:
curl -H 'Authorization: Bearer 4jymwea6btbqmre61wx6XXXXXX' http://localhost:8065/api/v4/channels/y4srrjqzoj8aunnnakb8px79eo/posts mihai@mihai-pc 11/03/21 20:29:42
{"order":["zbiymegh7ifabdforzpykd7zye","sm65ahhbbpr5ims7aixfinpryc","m8dsdxbcr3d7mkarcnyni7d3dw","6ab58mn8wt8kmejcu54py5kijo"],"posts":{"6ab58mn8wt8kmejcu54py5kijo":{"id":"6ab58mn8wt8kmejcu54py5kijo","create_at":1603220311183,"update_at":1603220311183,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"g1qsr6ebubghudqfzwryegi48c","channel_id":"y4srrjqzoj8aunnnakb8px79eo","root_id":"","parent_id":"","original_id":"","message":"mihaigalos joined the team.","type":"system_join_team","props":{"username":"mihaigalos"},"hashtags":"","pending_post_id":"","reply_count":0,"metadata":{}},"m8dsdxbcr3d7mkarcnyni7d3dw":{"id":"m8dsdxbcr3d7mkarcnyni7d3dw","create_at":1603220326473,"update_at":1603220326473,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"g1qsr6ebubghudqfzwryegi48c","channel_id":"y4srrjqzoj8aunnnakb8px79eo","root_id":"","parent_id":"","original_id":"","message":"hello everyone!","type":"","props":{"disable_group_highlight":true},"hashtags":"","pending_post_id":"","reply_count":0,"metadata":{}},"sm65ahhbbpr5ims7aixfinpryc":{"id":"sm65ahhbbpr5ims7aixfinpryc","create_at":1615480126769,"update_at":1615480126769,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"g1qsr6ebubghudqfzwryegi48c","channel_id":"y4srrjqzoj8aunnnakb8px79eo","root_id":"","parent_id":"","original_id":"","message":"This is a test.","type":"","props":{"disable_group_highlight":true},"hashtags":"","pending_post_id":"","reply_count":0,"metadata":{}},"zbiymegh7ifabdforzpykd7zye":{"id":"zbiymegh7ifabdforzpykd7zye","create_at":1615480129626,"update_at":1615480129626,"edit_at":0,"delete_at":0,"is_pinned":false,"user_id":"g1qsr6ebubghudqfzwryegi48c","channel_id":"y4srrjqzoj8aunnnakb8px79eo","root_id":"","parent_id":"","original_id":"","message":"And another one.","type":"","props":{"disable_group_highlight":true},"hashtags":"","pending_post_id":"","reply_count":0,"metadata":{}}},"next_post_id":"","prev_post_id":""}
Awesome. However, when I try to query after a specific Unix timestamp in milliseconds, it doesn't work. Why?
$ curl -H 'Authorization: Bearer 4jymwea6btbqmre61wx6XXXXXX' -d '{"since":1603200000000}' http://localhost:8065/api/v4/channels/y4srrjqzoj8aunnnakb8px79eo/posts
{"id":"api.context.404.app_error","message":"Sorry, we could not find the page.","detailed_error":"There doesn't appear to be an api call for the url='/api/v4/channels/y4srrjqzoj8aunnnakb8px79eo/posts'. Typo? are you missing a team_id or user_id as part of the url?","status_code":404}
My team is called foo
, so I tried with the URL http://localhost:8065/api/v4/foo/channels/y4srrjqzoj8aunnnakb8px79eo/posts
, still no luck..