Parked account.

Currently using freamon@lemmy.world

  • 21 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle

  • Hi. I’ve found the best place to test the api is here

    Example script for making a post

    my_instance="https://lemm.ee"
    
    auth="YOUR-JWT"
    community_id=COMMUNITY-ID
    name="TITLE OF POST"
    body="BODY OF POST"
    
    API="api/v3"
    
    create() {
            end_point="post"
            json_data="{\"auth\":\"$auth\",\"community_id\":$community_id,\"name\":\"$name\",\"body\":\"$body\"}"
    
            url="$my_instance/$API/$end_point"
    
            curl -H "Content-Type: application/json" -d "$json_data" "$url"
    }
    
    create
    

    You’ll need to get your instance’s community.id for the community you want to post to. To use this community as an example, it would be:

    my_instance="https://lemm.ee"
    
    API="api/v3"
    
    resolve() {
            end_point="resolve_object"
            www_data="q=https://lemmy.zip/c/linuxscripts"
    
            url="$my_instance/$API/$end_point?$www_data"
    
            curl "$url"
    }
    
    resolve
    

    (lemmy will probably sanitise the ampersand in that query, so you’ll have to replace the HTML with a literal ampersand)