Skip to content

Examples

# Discover a site
wrapido --url=https://example.com

# List routes in a namespace
wrapido wp/v2 --url=https://example.com

# Introspect a route (methods, args, supported --context values)
wrapido wp/v2 posts --url=https://example.com

# List, with query args and JSON output
wrapido wp/v2 posts list --per_page=5 --format=json --url=https://example.com

# List every post (all pages, at the route's maximum page size)
wrapido wp/v2 posts list --per_page=-1 --format=ids --url=https://example.com

# Get one, as edit context, authenticated
wrapido wp/v2 posts get 42 --context=edit --url=https://example.com --username=admin --password=xxxx-xxxx-xxxx-xxxx

# Create
wrapido wp/v2 posts create --title="Hello" --status=publish --url=https://example.com

# Update
wrapido wp/v2 posts update 42 --status=draft --url=https://example.com

# Delete
wrapido wp/v2 posts delete 42 --force --url=https://example.com

# Delete several posts at once (batched through /batch/v1 where the site allows it)
wrapido wp/v2 posts delete 42 43 44 --url=https://example.com

# Delete every draft: feed the ids from `list` straight into `delete`
wrapido --url=https://example.com wp/v2 posts delete $(wrapido --url=https://example.com wp/v2 posts list \
  --per_page=-1 --fields=id --format=ids --status=draft --quiet)

# Check whether an item exists (exit code 0/1, no output payload needed)
wrapido wp/v2 posts exists 42 --url=https://example.com

# Generate 5 posts reusing the same fields
wrapido wp/v2 posts generate --count=5 --status=publish --url=https://example.com

# Run a read-only WordPress ability (Abilities API)
wrapido wp-abilities/v1 abilities run get core/get-site-info --input='{"fields":["name","url"]}' --url=https://example.com

# Save defaults so you don't have to repeat --url/--username
wrapido config set --url=https://example.com --username=admin
wrapido config get
wrapido config clear

Meta

# List every meta key visible on post 42
wrapido wp/v2 posts meta list 42 --url=https://example.com

# Read one meta key
wrapido wp/v2 posts meta get 42 my_key --url=https://example.com

# Set a meta value
wrapido wp/v2 posts meta update 42 my_key "some value" --url=https://example.com

# Delete a whole meta key
wrapido wp/v2 posts meta delete 42 my_key --url=https://example.com

# Read/write a nested value inside a structured meta field
wrapido wp/v2 posts meta pluck 42 my_settings some.nested.path --url=https://example.com
wrapido wp/v2 posts meta patch 42 update my_settings some.nested.path "new value" --url=https://example.com

See Meta commands for the full set.

Uploads

# Single file (core media reads the `file` parameter)
wrapido wp/v2 media create --file=./cat.jpg --title="Cat" --url=https://example.com

# Several files, print only the new ids
wrapido wp/v2 media create --file=./a.jpg --file=./b.png --format=ids --url=https://example.com

# Attach to post 42; a custom route would use its own parameter name, e.g. --attachment=./a.pdf
wrapido wp/v2 media create --file=./cat.jpg --post=42 --url=https://example.com

See Uploading files.