Media

Create a media item

Changed on

Create a media item. Provide either album_id or category_id, and either embed_url or file.

post/media/

Request

  • Base URL
    https://example.com/api
  • Auth
    • OAuth 2
      Authorization codehttps://example.com/oauth2/authorize
      Token URLhttps://example.com/api/oauth2/token
      Scopesmedia:write
    • or API key in header XF-Api-Key
  • TypeScript
    A function with typed inputs. Its response is checked against the schema.

Request body multipart/form-data

album_idinteger

ID of the album to add media to. Required if category_id is not provided.

category_idinteger

ID of the category to add media to. Required if album_id is not provided.

embed_urlstring

URL to embed. Required if file is not uploaded.

filestring binary

Media file to upload. Required if embed_url is not provided.

titlestring
descriptionstring
tagsstring[]
custom_fields[<name>]string

Response

OK

successboolean
transcodingboolean

If true, the media requires transcoding and will be available later.

Note Conditionally returned

Changes

    • breaking

      removed the media type application/json from the request body

    • breaking

      removed the media type application/x-www-form-urlencoded from the request body

    • breaking

      the response's property type changed from string to boolean for status

    • info

      api operation id post_media_ removed and replaced with postMedia

    • info

      the endpoint scheme security XF-Api-Key was added to the API

    • info

      the endpoint scheme security XF-OAuth2 was added to the API

    • info

      added the new optional header request parameter XF-Api-User to all path's operations

    • info

      added the new optional query request parameter api_bypass_permissions to all path's operations

    • info

      added the media type multipart/form-data to the request body

    • info

      api tag Media added

    • info

      api tag media removed

    • info

      added optional request body

    • info

      added the media type application/json for the response with the status