CLI
Media upload
Upload a file or an https address to the media library, list and delete it, then use its id in a post from the terminal.
Media live in the library of an establishment. Upload once, then reuse the id in as many posts as you like. See Media for the formats and limits.
Upload a file or an address
media:upload takes a local file (sent as multipart) or an https address (sent as JSON). -e, --establishment is required. The answer holds the media id.
sofia media:upload ./tarte-tatin.jpg -e $ESTABLISHMENT_ID
sofia media:upload https://images.example.com/tarte-tatin.jpg -e $ESTABLISHMENT_IDAdd --idempotency-key to retry an upload without creating a duplicate.
sofia media:upload ./tarte-tatin.jpg -e $ESTABLISHMENT_ID --idempotency-key tarte-tatin-1List, read, delete
media:list needs -e, --establishment and paginates with --limit and --cursor. media:get and media:delete take the media id.
sofia media:list -e $ESTABLISHMENT_ID --limit 20
sofia media:get $MEDIA_ID
sofia media:delete $MEDIA_IDUpload, then post
Capture the id with jq, then pass it to posts:create -m.
MEDIA_ID=$(sofia media:upload ./tarte-tatin.jpg -e $ESTABLISHMENT_ID | jq -r '.id')
sofia posts:create -e $ESTABLISHMENT_ID -p instagram,facebook -c "Tarte tatin du jour" -m $MEDIA_IDWas this page helpful?