Endpoints
Notifications: Send
Description
Sends a notification to a specific user.
endpoint
|
/notifications/send
|
method
|
POST
|
authentication
|
required
|
Parameters
to_user_url
|
the URL of the user who will get the notification.
|
from_user_url
|
the URL of the user this notification is from.
|
content
|
the content of the notification.
|
Response
{
message_list: [ ],
success: true, // always use this boolean to check if the request succeeded
}
Example Request
// make sure you've initialized the library
// before you make requests using it!
// if you haven't, type in the following
IdeaMelt.init({api_key: IDEAMELT_KEY})
// now you're ready for awesomeness!
var data = {
from_user_url: "http://www.en.wikipedia.org/henry_ford",
to_user_url: "http://www.en.wikipedia.org/louis_armstrong",
content: "What a <a href='https://www.google.com/#q=weather'>wonderful day</a> it is today!"
}
var success = function(r) {
// everything went perfectly, do something awesome now!
// remember, this will fire asynchronously
}
var fail = function(r) {
// yikes! something didn't go right
// console.log(r.message_list) to see messages from the server
// ps. this will also fire asynchronously
}
// success and fail are optional parameters
IdeaMelt.send('NotifSend', data, success, fail);
$ curl \
-d "api_key=IDEAMELT_KEY" \
-d "from_user_url=http://www.en.wikipedia.org/henry_ford" \
-d "to_user_url=http://www.en.wikipedia.org/louis_armstrong" \
-d "content=What a <a href='https://www.google.com/#q=weather'>wonderful day</a> it is today!" \
http://api.ideamelt.com/v1/notifications/send/
$.ajax({
type: "POST",
url: "http://api.ideamelt.com/v1/notifications/send/",
data: {
api_key: "IDEAMELT_KEY",
from_user_url: "http://www.en.wikipedia.org/henry_ford",
to_user_url: "http://www.en.wikipedia.org/louis_armstrong",
content: "What a <a href='https://www.google.com/#q=weather'>wonderful day</a> it is today!"
},
dataType: "json",
success: function(r) { // remember, this will fire asynchronously
if (r.success) {
// everything went perfectly, do something awesome now!
}
else {
// yikes! something didn't go right
// print r.message_list to see messages from the server
}
},
error: function(r) { // remember, this will fire asynchronously
// yikes! something didn't go right
// print r.message_list to see messages from the server
}
});
# amazing library that makes HTTP requests super easy
# python-requests.org
import requests
url = "http://api.ideamelt.com/v1/notifications/send/"
payload = {
"api_key": "IDEAMELT_KEY",
"from_user_url": "http://www.en.wikipedia.org/henry_ford",
"to_user_url": "http://www.en.wikipedia.org/louis_armstrong",
"content": "What a <a href='https://www.google.com/#q=weather'>wonderful day</a> it is today!"
}
r = requests.post(url, data=payload)