[AC-3261] ACS Messages API documentation missing
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2012-04-21T04:11:34.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Documentation |
Labels | n/a |
Reporter | Sharry |
Assignee | Shak Hossain |
Created | 2012-04-20T07:28:00.000+0000 |
Updated | 2016-03-08T07:57:40.000+0000 |
Description
The new ACS documentation is missing the Messages API: http://docs.appcelerator.com/titanium/2.0/index.html#!/api/Titanium.Cloud
Old documentation:
Sends a message with an optional subject to one or more specified users. The thread_id of the first outgoing message is its own id. Replies to the first or subsequent messages in the thread will all use the id of the first message as their thread_id. The output of this API method is the copy of the message saved to the sender's sent mail.
URL: POST http://api.cocoafish.com/v1/messages/create.json
*Required Parameters:*
to_ids one or more Ids of users to send the message to
body the body of the message
*Optional Parameters:*
subject message subject
custom_data_fields user-defined data.
*Example cURL request:*
$ curl -b cookies.txt -c cookies.txt -F "to_ids=4d71445b6f70951043000006,4d7184f06f70951043000012" -F "subject=Sunday Afternoon" -F "body=Howabout going to the Academy of Sciences?" http://api.cocoafish.com/v1/messages/create.json?key=
Example JSON response:
{
"meta": {
"status":"ok",
"code":200,
"method_name":"createMessage"
},
"response": {
"messages": [
{
"id":"4d85418dd0afbe013e000027",
"thread_id":"4d85418dd0afbe013e000025",
"status":"sent",
"subject":"Sunday Afternoon",
"body":"Howabout going to the Academy of Sciences?",
"created_at":"2011-03-19T23:51:41+0000",
"updated_at":"2011-03-19T23:51:41+0000",
"from": {
"id":"4d7e6493d0afbe01d8000001",
"first_name":"Michael",
"last_name":"Goff",
"created_at":"2011-03-14T18:55:15+0000",
"updated_at":"2011-03-19T05:05:29+0000"
},
"to": [
{
"id":"4d854129d0afbe013e000022",
"first_name":"Wei",
"last_name":"Kong",
"created_at":"2011-03-19T23:50:01+0000",
"updated_at":"2011-03-19T23:50:01+0000"
},
{
"id":"4d85415ad0afbe013e000023",
"first_name":"George",
"last_name":"Dy",
"created_at":"2011-03-19T23:50:50+0000",
"updated_at":"2011-03-19T23:50:50+0000"
}
]
}
]
}
*Example Javascript call:*
var sdk = new Cocoafish(''); // app key
var data = {
to_ids = '4d71445b6f70951043000006,4d7184f06f70951043000012',
body = 'new message!'
};
sdk.sendRequest('messages/create.json', 'POST', data, false, callback);
SDK Callback:
function callback(data) {
if(data) {
if(data.meta)) {
var meta = data.meta;
if(meta.status == 'ok' && meta.code == 200 && meta.method_name == 'createMessage') {
var messages = data.response.messages;
...
}
}
}
}
Sharry
Thank you for raising this, Sharry. As a ticket already exists for this at TIDOC-572, I am going close this one. Don't worry - we have it in our todo lists to resolve very soon.