Upload an attachment

POST /attachments
application/json

Body

  • parent integer

    Parent object ID.

  • parent_model string

    Parent model name (e.g. user).

  • parent_field string

    Parent model field (e.g. image).

  • file string(file)

    File contents.

Responses

  • 201
POST /attachments
curl \
 --request POST '/wp-json/hivepress/v1/attachments' \
 --header "Content-Type: application/json" \
 --data '{"parent":42,"parent_model":"string","parent_field":"string","file":"string"}'
Request examples
{
  "parent": 42,
  "parent_model": "string",
  "parent_field": "string",
  "file": "string"
}