Japanese Speaker. I can read/write some English but not well, so corrections are always appreciated.

プログラミングや音楽に興味があります。最近はEmacsでよく遊んでます。

  • 0 Posts
  • 16 Comments
Joined 1 year ago
cake
Cake day: June 18th, 2023

help-circle














  • Hi! The first curl example doesn’t seem to work - it fetches comments but they are not relevant to https://lemmy.world/post/290602 :

    > curl -H 'Accept: application/activity+json' "https://lemmy.world/api/v3/comment/list?limit=10&postId=290602" | jq -c '.comments[] | [.post.id, .comment.id, community.name]'
    [484044,486431,"nostupidquestions"]
    [455772,486976,"giftofgaming"]
    ...
    [485477,486428,"outoftheloop"]
    [484044,485717,"nostupidquestions"]
    

    It seems that we need to set type_ parameter like this:

    > curl -H 'Accept: application/activity+json' "https://lemmy.world/api/v3/comment/list?limit=10&post_id=290602&type_=All" | jq -c '.comments[] | [.post.id, .comment.id, community.
    name]'
    [290602,484328,"programmer_humor"]
    [290602,374758,"programmer_humor"]
    ...
    [290602,355277,"programmer_humor"]
    [290602,345799,"programmer_humor"]
    

  • It seems OAuth2 hasn’t implemented yet. At this time, to get auth value, username and password are required:

    # Python
    url = 'https://<instance_name>/user/login'
    data = {'username_or_email': username_or_email,
            'password': password}
    response = requests.post(url, json=data)
    json = response.json()
    auth = json['jwt']
    

    Since the endpoint recieves JSON then returns JSON, you may need to send following HTTP headers explicitly:

    Content-Type: application/json
    Accept: application/json