Home

 

Create media resources

When you upload a file to a blog, the server creates a media resource entry to represent the file. To create a media resource, post the file to the blog using the HTTP POST method.

The types of files, and the maximum sizes of the files that can be uploaded to a blog is defined by the Blogs administrator. See the Administering Blogs section of the Lotus Connections information center for more details.

In addition to creating a media resource entry to represent the file, the server also creates an entry called a media link entry that contains information about the file. You can use the media link entry to separately retrieve metadata of the media resource. See Authenticating requests for information about how to authenticate the request.

Draft authors are not allowed to post media content to a blog.


Atom API request details

Method Resource URI Input representation
POST Media link entries Value of the href attribute of the <collection> element that has a child <title> element with a value of Media Entries in the user's service document. file

 

Input

Provide a data file in one of the following ways:

  • Use the HTTP entity-header of Slug to specify the file. (See the Atom Publishing Protocol specification for allowed values of this header.) For example, specify the slug as follows:

      POST /hostname/path/to/media/resources HTTP/1.1 Host: ... Authorization: ... Slug: Gulls Content-Type: image/jpg Content-Length: 6730
      

    You must also specify the content type of the file. For example, if the file has a JPEG extension, specify the content type as follows:

      content-type:image/jpeg 
      

     

    Output

    None. Returned HTTP Headers

      HTTP/1.1 201 Created

      Indicates that the file was successfully uploaded. If an error occurs, this header will contain one of the error codes below.

      Location: url

      Link to the media link entry created by the server for the file. You can use the Web address specified here to obtain information about the file by retrieving the media link entry. Once retrieved, you can use the edit-media link in the media link entry to update the media resource file itself.

    Error codes

    • HTTP/1.1 401 Unauthorized

    • HTTP/1.1 404 Not Found

    • HTTP/1.1 409 Conflict: Indicates that a file with the same file name already exists in the upload folder. To resolve the problem, either assign a unique name to the request's "slug" header or do not assign anything to this header and let the server generate a file name. Note that if you let the server generate the name, it uses the blog handle and time stamp for the file name, and might be difficult to recognize. Also, if you are using a third-party blogging tool, the server automatically takes the file name and assigns that to the slug header, so if you post the file twice in the third-party blogging tool without changing the file name after the first post, you will get a 409 error the second time.


    Working with media resources

     

    Related reference


    Media link content


    +

    Search Tips   |   Advanced Search