The workroom/postMessage method is an Elance Developer API Workroom method that enables an authenticated user to submit a new message to a workroom. Attachments on messages are supported using a MIME multi-part POST request, as specified by RFC2046.

workroom/postMessage is an authenticated method. It requires a Developer API key and an OAuth authentication key, both issued by Elance. It is invoked using an HTTP or HTTPS POST request. For more details on the OAuth authentication protocol, see Using OAuth with Authenticated Methods.

This method does not support the JSONP response format.

For more information on the format of an Elance Developer API request, see Getting Started.

I. Required Query String Parameters

Parameter Description
bidId The bid ID representing the workroom.
comments The text of the message to post.

Attachments should be uploaded via POST.

II. Response Data Description

Property Data Type Description
messageId integer The unique ID associated with this message.

III. File Uploads

Files are uploaded using a MIME multipart POST request, as specified in RFC2046, section 5.1.

IV. Request/Response Examples in JSON

1. Posting a Message without Attachments

The following example HTTP POST request submits a simple message to the workroom. The HTTP headers for the POST request are shown below. (NOTE: Elance recommends that developers access OAuth APIs using one of the many publicly available libraries.)

A. postMessage Request

POST /api/workroom/postMessage HTTP/1.1
User-Agent: anyMeta/OAuth 1.0 - ($LastChangedRevision: 134 $)
Accept: */*
Authorization: OAuth realm="",oauth_signature_method="HMAC-SHA1",oauth_signature="EbgfLZYRj0NF53IRpdGyFacmiCA%3D",oauth_nonce="4c93aac84437a",oauth_timestamp="1284745928",oauth_token="2030028725-1707664-1707664-24.18.75-af50e68abf02753-%2A",oauth_consumer_key="8dfc476b57fee5b7dc08cc0f1d5a0fcdab409b3c",oauth_version="1.0"
Content-Type: application/x-www-form-urlencoded
Content-Length: 38

B. Response

	"apiVersion": 1,   
	"rcode": 1,   
	"data": { 
		"messageid": "10291827"

V. Error Codes

If the Elance Developer API encounters an error in processing the request, it may return one of the error codes below. The format of error responses is specified in the Getting Started page. For a list of other common errors that can be thrown by this method, see Common API Error Codes.

Error Code Description
E_WORKROOM_INVALID_BID The bidId is invalid, or was not specified.
E_WORKROOM_BID_ACCESS The user specified by userId does not have permission to view this bid.
E_WORKROOM_FILE_INVALID The file uploaded through a multi-part submission is malformed, or cannot otherwise be accepted by Elance.