Pushed API
The API lets you interact with Pushed from anything that can send an HTTP request. There are many things you can do with the API. For example:
Send notifications to all your subscribers Schedule notifications to some of your subscribers Subscribe users to your applications and channels Fetch your notifications analytics And much more! Schema
All API access is over HTTPS, and accessed from the api.pushed.co
domain. The relative path prefix /1/
indicates that we are currently using version 1 of the API.
Current endpoint is https://api.pushed.co/1
.
Request content type must be application/x-www-form-urlencoded
and Pushed response comes as application/json
.
Response Format
The response format for all requests is a JSON object.
Whether a request succeeded is indicated by the HTTP status code. A 2xx
status code indicates success , whereas a 4xx
status code indicates failure .
For example, trying to verify an authorization code that is valid will return the message:
{
"response": {
"type": "auth_code_valid",
"message": "Authorization Code is valid."
}
}
Client Errors
When a request fails, the response body is still JSON, but always contains the fields code and error which you can inspect to use for debugging.
For example, trying to verify an authorization code that is invalid will return the message:
{
"error": {
"type": "auth_code_invalid",
"message": "Authorization Code is not valid."
}
}
Timezones
Pushed timezone is set to UTC
, so all dates will be offered in this timezone.
Credentials
There are three credentials methods to use the API. Depending on what you want to accomplish, you will need to add to your request the required credentials.
Target Based Credential: Using your Pushed app/channel credentials (app_key
, app_secret
& target_alias
).
Pushed Api-Key Based: Using your Pushed account api_key
.
OAuth-Credentials Based: Using the access_token
genereated in the OAuth process.
No Credential Required: Some API calls does not require any credentials.
Which one to use? We know this could be a little tedious but security is a huge concern and that's the best way to ensure your account data and privacy. For each of the methods of the API you will se a badge of what credentials are required.
Quick Reference Available Methods
Sending Notifications Authorization Subscription Management Applications Management Channels Management Account Management Analytics Sending Notifications
https://api.pushed.co/1/push
POST This method allows Pushed applications to send notifications programatically. There are four options to reach Pushed users (we called it targets ): app , channel , user or pushed identifier . Depending on your needs you will have to provide specific parameter to the push
call.
Parameter Name Type Required Description app_key
string Yes Your application key. You can find your app_key
on the settings section of your application inside the developer portal . app_secret
string Yes Your application secret. You can find your app_secret
on the settings section of your application inside the developer portal . content
string Yes The content of the notification. Max length is 140 characters. If your content is larger than 140 characters the API will return an error: message_is_too_large
. content_type
string Optional The content type of the notification. Currently there's only one option available: url
. If this parameter is specified then special behaviour is applied to notification in order to show it properly. content_extra
string Optional The extra content of the notification. Depending on content_type
parameter should be filled with relevant data. target_type
string Yes The type of the destination. Allowed options: app
, channel
, user
, pushed_id
, subscription_alias
or email
. target_alias
string Optional Only required when target_type != app
. Depending on the target_type
the target_alias
must include different information. access_token
string Optional Only required when target_type = user
. You can obtain this value when your application requests OAuth access. pushed_id
string Optional Only required when target_type = pushed_id
. The Pushed Identifier string of the user. email
string Optional Only required when target_type = email
. This is the email the user used to register in Pushed. It must be subscribed to your app or channel.
Sending a notification to a Pushed App
Here's an example of the most common request to send a notification using our API. In this case we send a notification to everyone subscribed to the app we specify in the target_alias
parameter. Be aware that depending on your app settings, you will need different parameters.
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=your_target_type" \
--form-string "content=Your notification content." \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "your_target_type",
"content" => "Your notification content."
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "your_target_type",
"content" => "Your notification content."
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "your_target_type",
:content => "Your notification content."})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "your_target_type",
"content": "Your notification content."}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "your_target_type",
"content": "Your notification content."
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Sending a notification to a Pushed Channel
This example illustrates how to send a notification to a Pushed channel. As you might have pointed out, the only difference from a regular app notification request is that we add the parameter target_type
to channel
to specify the channel.
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=channel" \
--form-string "target_alias=your_app_or_channel_alias" \
--form-string "content=Your notification content." \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "channel",
"target_alias" => "your_app_or_channel_alias",
"content" => "Your notification content."
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "channel",
"target_alias" => "your_app_or_channel_alias",
"content" => "Your notification content."
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "channel",
:target_alias => "your_app_or_channel_alias",
:content => "Your notification content."})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "channel",
"target_alias": "your_app_or_channel_alias",
"content": "Your notification content."}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "channel",
"target_alias": "your_app_or_channel_alias",
"content": "Your notification content."
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Sending a notification with a URL (link to a website)
Sometimes it's useful to attach a URL into a notification. This URL will be attached to the notification and the user will be able to open the link within the Pushed app.
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=your_target_type" \
--form-string "content=Your notification content." \
--form-string "content_type=url" \
--form-string "content_extra=https://pushed.co" \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "your_target_type",
"content" => "Your notification content.",
"content_type" => "url",
"content_extra" => "https://pushed.co"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "your_target_type",
"content" => "Your notification content.",
"content_type" => "url",
"content_extra" => "https://pushed.co"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "your_target_type",
:content => "Your notification content.",
:content_type => "url",
:content_extra => "https://pushed.co"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "your_target_type",
"content": "Your notification content.",
"content_type": "url",
"content_extra": "https://pushed.co"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "your_target_type",
"content": "Your notification content.",
"content_type": "url",
"content_extra": "https://pushed.co"
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Targets
Depending on which target you want to reach for your notifications, you will have to specify the target_type
parameter. This option allows you to send a notification to everyone subscribed to your channel, or specific users. These are the available target types:
Target Name Description app
Send a notification to all subscribers of an app. channel
Send a notification to all subscribers of a channel. user
Send a notification to an specific user specifying user alias. (OAuth required) pushed_id
Send a notification to an specific user specifying Pushed ID. email
Send a notification to an specific user using its email (registered in Pushed).
Sending a notification to specific users
If you need to send a notification to a certain user, you have several options: using the subscription alias , email , PushedID or the OAuth token . Below you can find multiple examples of sending a push message using user-based targets.
Sending a notification to an specific user using email
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=email" \
--form-string "email=john@doe.com" \
--form-string "content=Your notification content." \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "email",
"email" => "john@doe.com",
"content" => "Your notification content."
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "email",
"email" => "john@doe.com",
"content" => "Your notification content."
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "email",
:email => "john@doe.com",
:content => "Your notification content."})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "email",
"email": "john@doe.com",
"content": "Your notification content."}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "email",
"email": "john@doe.com",
"content": "Your notification content."
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
And another example of sending a push message using
email using our API to a Channel:
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=email" \
--form-string "target_alias=your_app_or_channel_alias" \
--form-string "email=john@doe.com" \
--form-string "content=Your notification content." \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "email",
"target_alias" => "your_app_or_channel_alias",
"email" => "john@doe.com",
"content" => "Your notification content."
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "email",
"target_alias" => "your_app_or_channel_alias",
"email" => "john@doe.com",
"content" => "Your notification content."
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "email",
:target_alias => "your_app_or_channel_alias",
:email => "john@doe.com",
:content => "Your notification content."})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "email",
"target_alias": "your_app_or_channel_alias",
"email": "john@doe.com",
"content": "Your notification content."}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "email",
"target_alias": "your_app_or_channel_alias",
"email": "john@doe.com",
"content": "Your notification content."
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Sending a notification to an specific user using PushedID
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=pushed_id" \
--form-string "pushed_id=user_pushed_id" \
--form-string "content=Your notification content." \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "pushed_id",
"pushed_id" => "user_pushed_id",
"content" => "Your notification content."
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "pushed_id",
"pushed_id" => "user_pushed_id",
"content" => "Your notification content."
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "pushed_id",
:pushed_id => "user_pushed_id",
:content => "Your notification content."})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "pushed_id",
"pushed_id": "user_pushed_id",
"content": "Your notification content."}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "pushed_id",
"pushed_id": "user_pushed_id",
"content": "Your notification content."
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Sending a notification to an specific user using OAuth Protocol
If you need to send a notification to a certain user, you can get user permissions by setting up Pushed OAuth Protocol in your system. Once the user has established connection with Pushed and granted your app access you will receive an access_token
. You can use this access_token
to send notifications without the need to add further parameters. Very Important: Only apps can use access_token
, channels are not allowed to use target_type = user
.
Below you can find an example of sending a push message using the OAuth Token using our API:
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "access_token=access_token_code_given_by_pushed" \
--form-string "target_type=user" \
--form-string "target_alias=your_channel_alias" \
--form-string "content=Your notification content." \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"access_token" => "access_token_code_given_by_pushed",
"target_type" => "user",
"target_alias" => "your_channel_alias",
"content" => "Your notification content."
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"access_token" => "access_token_code_given_by_pushed",
"target_type" => "user",
"target_alias" => "your_channel_alias",
"content" => "Your notification content."
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:access_token => "access_token_code_given_by_pushed",
:target_type => "user",
:target_alias => "your_channel_alias",
:content => "Your notification content."})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"access_token": "access_token_code_given_by_pushed",
"target_type": "user",
"target_alias": "your_channel_alias",
"content": "Your notification content."}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"access_token": "access_token_code_given_by_pushed",
"target_type": "user",
"target_alias": "your_channel_alias",
"content": "Your notification content."
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Sending a notification to an specific user using subscription alias
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "target_type=subscription_alias" \
--form-string "content=Your notification content." \
--form-string "subscription_alias=alias_of_the_subscription" \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "subscription_alias",
"content" => "Your notification content.",
"subscription_alias" => "alias_of_the_subscription"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"target_type" => "subscription_alias",
"content" => "Your notification content.",
"subscription_alias" => "alias_of_the_subscription"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:target_type => "subscription_alias",
:content => "Your notification content.",
:subscription_alias => "alias_of_the_subscription"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "subscription_alias",
"content": "Your notification content.",
"subscription_alias": "alias_of_the_subscription"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"target_type": "subscription_alias",
"content": "Your notification content.",
"subscription_alias": "alias_of_the_subscription"
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Sending a notification to an specific user using subscription alias (with OAuth access token)
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "access_token=access_token_code_given_by_pushed" \
--form-string "target_type=subscription_alias" \
--form-string "subscription_alias=alias_of_the_subscription" \
--form-string "content=Your notification content." \
https://api.pushed.co/1/push
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/push", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"access_token" => "access_token_code_given_by_pushed",
"target_type" => "subscription_alias",
"subscription_alias" => "alias_of_the_subscription",
"content" => "Your notification content."
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/push",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"access_token" => "access_token_code_given_by_pushed",
"target_type" => "subscription_alias",
"subscription_alias" => "alias_of_the_subscription",
"content" => "Your notification content."
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:access_token => "access_token_code_given_by_pushed",
:target_type => "subscription_alias",
:subscription_alias => "alias_of_the_subscription",
:content => "Your notification content."})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/push', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"access_token": "access_token_code_given_by_pushed",
"target_type": "subscription_alias",
"subscription_alias": "alias_of_the_subscription",
"content": "Your notification content."}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"access_token": "access_token_code_given_by_pushed",
"target_type": "subscription_alias",
"subscription_alias": "alias_of_the_subscription",
"content": "Your notification content."
}
r = requests.post("https://api.pushed.co/1/push", data=payload)
print(r.text)
Authorization
oauth
https://api.pushed.co/1/oauth GET This method allows you to create the page where the user can authorize your Pushed app to access several information on their account. Remember that users can revoke permisions at any time.
Parameter Name Type Required Description client_id
string Yes Your application key. You can find your app_key
on the settings section of your application inside the developer portal . redirect_uri
string Yes The URL Pushed will use to callback with the authorization details response.
oauth/access_token
https://api.pushed.co/1/oauth/access_token POST This method is used to exchange the code provided in https://api.pushed.co/1/oauth
an access token. You should store the given access_token
in your system so you can send interact with Pushed API methods at any time.
oauth/verify
https://api.pushed.co/1/oauth/verify POST This method allows you to check if an access_token
is valid. This method shoudl be used to check permissions in case you are having issues with the access_token
. Remember that users can revoke permisions at any time.
oauth
https://api.pushed.co/1/oauth DELETE Remove a previous access_token
.
Subscription Management
# subscriptions
https://api.pushed.co/1/subscriptions GET This method allows you to list all subscriptions from a user. To use this method you need an OAuth access token. Learn More .
Example of a valid
subscription
response listing subscriptions:
{
"response": {
"type": "user_subscriptions_fetched",
"message": "User subscriptions fetched.",
"data": {
"subscriptions": [
{
"subscription_alias": "CqVGmwordX",
"source_type": "app",
"created_at": {
"date": "2016-08-23 10:48:25.000000",
"timezone_type": 3,
"timezone": "UTC"
},
"source_alias": "abc123",
"source_name": "Name of the app",
"source_icon": "https://s3-eu-west-1.amazonaws.com/pushed.co/media/pushed.png",
}
]
}
}
}
# subscription
https://api.pushed.co/1/subscription POST This method allows you to subscribe a user token one of your sources (app or channel). To use this method you need an OAuth access token. Learn More .
You can not subscribe a user to an app or channel that is not yours.
Parameter Name Type Required Description access_token
string Yes The code
provided by https://api.pushed.co/1/oauth
. source_alias
string Yes The alias
of your source (app or channel). source_type
string Yes Allowed options: app
or channel
.
Example of a valid
subscription
created response:
{
"response": {
"type": "subscription_created",
"message": "Subscription to Pushed Demo App created successfully.",
"data": {
{
"subscription_alias": "CqVGmwordX",
}
}
}
}
# subscription
https://api.pushed.co/1/subscription DELETE This method allows you to unsubscribe user from one of your sources (app or channel). To use this method you need an OAuth access token. Learn More .
You can not unsubscribe a user to an app or channel that is not yours.
Example of a valid
subscription
delete response:
{
"response": {
"type": "subscription_deleted",
"message": "Subscription to Pushed Demo App deleted successfully.",
}
}
# subscription/invite
https://api.pushed.co/1/subscription/invite POST This method allows you to invite users to subscribe to one of your sources (app or channel).
Parameter Name Type Required Description app_key
string Yes Your application key. You can find your app_key
on the settings section of your application inside the developer portal . app_secret
string Yes Your application secret. You can find your app_secret
on the settings section of your application inside the developer portal . source_type
string Yes Allowed options: app
or channel
. source_alias
string Optional Only required when source_type != app
. emails
string Yes List of comma separated emails to send invitations to.
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "source_type=your_source_type" \
--form-string "source_alias=your_app_or_channel_alias" \
--form-string "emails=emails_list_comma_separated" \
https://api.pushed.co/1/subscription/invite
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/subscription/invite", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"source_type" => "your_source_type",
"source_alias" => "your_app_or_channel_alias",
"emails" => "emails_list_comma_separated"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/subscription/invite",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"source_type" => "your_source_type",
"source_alias" => "your_app_or_channel_alias",
"emails" => "emails_list_comma_separated"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/subscription/invite")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:source_type => "your_source_type",
:source_alias => "your_app_or_channel_alias",
:emails => "emails_list_comma_separated"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/subscription/invite', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"source_type": "your_source_type",
"source_alias": "your_app_or_channel_alias",
"emails": "emails_list_comma_separated"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"source_type": "your_source_type",
"source_alias": "your_app_or_channel_alias",
"emails": "emails_list_comma_separated"
}
r = requests.post("https://api.pushed.co/1/subscription/invite", data=payload)
print(r.text)
Example of a valid
subscription/invite
response:
{
"response": {
"type": "invitations_created_successfully",
"message": "Invitations created successfully.",
"data": {
{
"count": 1,
}
}
}
}
Applications Management
https://api.pushed.co/1/app
GET This method lists all of your applications.
Parameter Name Type Required Description pushed_id
string yes Your account PushedID (you can get it from your account settings page ). api_key
string yes Your account api key (you can get it from your account settings page ).
Sample Code: Command Line
Copy Codecurl -X GET -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
https://api.pushed.co/1/app
use LWP::UserAgent;
LWP::UserAgent->new()->get(
"https://api.pushed.co/1/app", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app?pushed_id=user_pushed_id&api_key=user_api_key",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app")
req = Net::HTTP::Get.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('GET', '/1/app', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key"
}
r = requests.get("https://api.pushed.co/1/app", data=payload)
print(r.text)
Example of a valid app
response listing apps:
{
"response": {
"type": "account_apps_fetched_successfully",
"message": "Account apps fetched successfully.",
"data": {
"apps": {
{
"name": "Pushed Demo App",
"description": "App Description",
"alias": "abc123",
"public": 1,
"members_only": 0,
"icon": "https://s3-eu-west-1.amazonaws.com/pushed.co/static/apps/abc123/abc123.png",
"app_key": "app_key",
"app_secret": "app_secret",
"created_at": "2014-09-17 18:57:59"
}
}
}
}
}
https://api.pushed.co/1/app
PUT This method allows you to create a new application.
Parameter Name Type Required Description pushed_id
string yes Your account PushedID (you can get it from your account settings page ). api_key
string yes Your account api key (you can get it from your account settings page ). name
string Yes App name. description
string Yes App description. public
boolean Optional Wether your app will be publicly available or not (Private by default ). icon_url
string Optional App icon url (will be saved to Pushed). tags
string Optional Comma separated app tags. supercategory
string Optional App category. Options available: Pushed Picks
, News
, Tech & Science
, Internet
, Sports
, Business
, Design
, Music
, Films & TV
, Travel
, Food
, Style
.
Sample Code: Command Line
Copy Codecurl -X PUT \
https://api.pushed.co/1/app \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'pushed_id=user_pushed_id&api_key=user_api_key&name=name_of_the_app&description=description_of_the_app&public=public_visibility&icon_url=url_of_the_icon&tags=tags%2Ccomma%2Cseparated&supercategory=style'
use LWP::UserAgent;
LWP::UserAgent->new()->put(
"https://api.pushed.co/1/app", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"name" => "name_of_the_app",
"description" => "description_of_the_app",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon",
"tags" => "tags,comma,separated",
"supercategory" => "style"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app",
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => array(
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"name" => "name_of_the_app",
"description" => "description_of_the_app",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon",
"tags" => "tags,comma,separated",
"supercategory" => "style"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app")
req = Net::HTTP::Put.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:name => "name_of_the_app",
:description => "description_of_the_app",
:public => "public_visibility",
:icon_url => "url_of_the_icon",
:tags => "tags,comma,separated",
:supercategory => "style"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('PUT', '/1/app', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"name": "name_of_the_app",
"description": "description_of_the_app",
"public": "public_visibility",
"icon_url": "url_of_the_icon",
"tags": "tags,comma,separated",
"supercategory": "style"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"name": "name_of_the_app",
"description": "description_of_the_app",
"public": "public_visibility",
"icon_url": "url_of_the_icon",
"tags": "tags,comma,separated",
"supercategory": "style"
}
r = requests.put("https://api.pushed.co/1/app", data=payload)
print(r.text)
https://api.pushed.co/1/app
POST This method allows you to edit an application.
Parameter Name Type Required Description app_key
string Yes Your application key. You can find your app_key
on the settings section of your application inside the developer portal . app_secret
string Yes Your application secret. You can find your app_secret
on the settings section of your application inside the developer portal . name
string Optional App name. description
string Optional App description. public
boolean Optional Wether your app will be publicly available or not (1
means public, 0
means private). icon_url
string Optional App icon url (will be saved to Pushed).
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "name=name_of_the_app" \
--form-string "description=description_of_the_app" \
--form-string "public=public_visibility" \
--form-string "icon_url=url_of_the_icon" \
https://api.pushed.co/1/app
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/app", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"name" => "name_of_the_app",
"description" => "description_of_the_app",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"name" => "name_of_the_app",
"description" => "description_of_the_app",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:name => "name_of_the_app",
:description => "description_of_the_app",
:public => "public_visibility",
:icon_url => "url_of_the_icon"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/app', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"name": "name_of_the_app",
"description": "description_of_the_app",
"public": "public_visibility",
"icon_url": "url_of_the_icon"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"name": "name_of_the_app",
"description": "description_of_the_app",
"public": "public_visibility",
"icon_url": "url_of_the_icon"
}
r = requests.post("https://api.pushed.co/1/app", data=payload)
print(r.text)
https://api.pushed.co/1/app
DELETE This method removes an applications.
Parameter Name Type Required Description pushed_id
string yes Your account PushedID (you can get it from your account settings page ). api_key
string yes Your account api key (you can get it from your account settings page ). app_alias
string required App alias.
Sample Code: Command Line
Copy Codecurl -X DELETE -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "app_alias=alias_of_the_app" \
https://api.pushed.co/1/app
use LWP::UserAgent;
LWP::UserAgent->new()->delete(
"https://api.pushed.co/1/app", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"app_alias" => "alias_of_the_app"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app",
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => array(
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"app_alias" => "alias_of_the_app"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app")
req = Net::HTTP::Delete.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:app_alias => "alias_of_the_app"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('DELETE', '/1/app', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"app_alias": "alias_of_the_app"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"app_alias": "alias_of_the_app"
}
r = requests.delete("https://api.pushed.co/1/app", data=payload)
print(r.text)
Example of a valid app
deletion response:
{
"response": {
"type": "app_deleted_succesfully",
"message": "App (app name) deleted successfully."
}
}
https://api.pushed.co/1/app/subscriptions
GET This method retrieves application subscriptions.
Parameter Name Type Required Description pushed_id
string yes Your account PushedID (you can get it from your account settings page ). api_key
string yes Your account api key (you can get it from your account settings page ). alias
string required App alias.
Sample Code: Command Line
Copy Codecurl -X GET -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "alias=alias_of_the_app" \
https://api.pushed.co/1/app/subscriptions
use LWP::UserAgent;
LWP::UserAgent->new()->get(
"https://api.pushed.co/1/app/subscriptions", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"alias" => "alias_of_the_app"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app/subscriptions?pushed_id=user_pushed_id&api_key=user_api_key&alias=alias_of_the_app",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app/subscriptions")
req = Net::HTTP::Get.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:alias => "alias_of_the_app"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('GET', '/1/app/subscriptions', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"alias": "alias_of_the_app"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"alias": "alias_of_the_app"
}
r = requests.get("https://api.pushed.co/1/app/subscriptions", data=payload)
print(r.text)
Example of a valid app/subscriptions
response:
{
"response": {
"type": "subscribers_successfully_fetched",
"message": "App subscribers successfully fetched.",
"data": {
"subscriptions": [
{
"alias": "subscription_alias",
"email": "hello@pushed.co",
"subscribed_at": {
"date": "2018-08-30 12:13:44.000000",
"timezone_type": 3,
"timezone": "UTC"
}
},
]
}
}
}
https://api.pushed.co/1/app/subscription
GET This method retrieves an specific app subscription. You must send either subscription_alias
or subscription_email
in order to get the subscription data.
Parameter Name Type Required Description pushed_id
string yes Your account PushedID (you can get it from your account settings page ). api_key
string yes Your account api key (you can get it from your account settings page ). app_alias
string required App alias. subscription_alias
string optional (one search needle required) Subscription alias. subscription_email
string optional (one search needle required) Subscription email.
Sample Code: Command Line
Copy Codecurl -X GET -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "subscription_alias=alias_of_the_subscription" \
--form-string "subscription_email=email_of_the_subscription" \
https://api.pushed.co/1/app/subscription
use LWP::UserAgent;
LWP::UserAgent->new()->get(
"https://api.pushed.co/1/app/subscription", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"subscription_alias" => "alias_of_the_subscription",
"subscription_email" => "email_of_the_subscription"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app/subscription?pushed_id=user_pushed_id&api_key=user_api_key&subscription_alias=alias_of_the_subscription&subscription_email=email_of_the_subscription",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app/subscription")
req = Net::HTTP::Get.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:subscription_alias => "alias_of_the_subscription",
:subscription_email => "email_of_the_subscription"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('GET', '/1/app/subscription', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"
}
r = requests.get("https://api.pushed.co/1/app/subscription", data=payload)
print(r.text)
Example of a valid app/subscription
GET response:
{
"response": {
"type": "subscription_successfully_fetched",
"message": "App subscription successfully fetched.",
"data": {
"subscription": {
"alias": "subscription_alias",
"email": "hello@pushed.co",
"subscribed_at": {
"date": "2018-05-08 15:24:08.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
}
}
}
https://api.pushed.co/1/app/subscription
DELETE This method removes an specific app subscription. You must send either subscription_alias
or subscription_email
in order to unsubscribe the user from the app.
Parameter Name Type Required Description pushed_id
string yes Your account PushedID (you can get it from your account settings page ). api_key
string yes Your account api key (you can get it from your account settings page ). app_alias
string required App alias. subscription_alias
string optional (one search needle required) Subscription alias. subscription_email
string optional (one search needle required) Subscription email.
Sample Code: Command Line
Copy Codecurl -X DELETE -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "subscription_alias=alias_of_the_subscription" \
--form-string "subscription_email=email_of_the_subscription" \
https://api.pushed.co/1/app/subscription
use LWP::UserAgent;
LWP::UserAgent->new()->delete(
"https://api.pushed.co/1/app/subscription", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"subscription_alias" => "alias_of_the_subscription",
"subscription_email" => "email_of_the_subscription"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app/subscription",
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => array(
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"subscription_alias" => "alias_of_the_subscription",
"subscription_email" => "email_of_the_subscription"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app/subscription")
req = Net::HTTP::Delete.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:subscription_alias => "alias_of_the_subscription",
:subscription_email => "email_of_the_subscription"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('DELETE', '/1/app/subscription', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"
}
r = requests.delete("https://api.pushed.co/1/app/subscription", data=payload)
print(r.text)
Example of a valid app/subscription
DELETE response:
{
"response": {
"type": "subscription_successfully_deleted",
"message": "App subscription successfully deleted."
}
}
Channels Management
https://api.pushed.co/1/channel
GET This method lists all your channels.
Parameter Name Type Required Description pushed_id
string Yes Your account PushedID (you can get it from your account settings page ). api_key
string Yes Your account api key (you can get it from your account settings page ).
Sample Code: Command Line
Copy Codecurl -X GET -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
https://api.pushed.co/1/channel
use LWP::UserAgent;
LWP::UserAgent->new()->get(
"https://api.pushed.co/1/channel", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/channel?pushed_id=user_pushed_id&api_key=user_api_key",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/channel")
req = Net::HTTP::Get.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('GET', '/1/channel', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key"
}
r = requests.get("https://api.pushed.co/1/channel", data=payload)
print(r.text)
Example of a valid channel
response listing:
{
"response": {
"type": "account_channels_fetched_successfully",
"message": "Account channels fetched successfully.",
"data": {
"channels": {
{
"name": "Channel name",
"alias": "channel_alias",
"public": 1,
"members_only": 0,
"icon": "https://s3-eu-west-1.amazonaws.com/pushed.co/media/pushed.png",
"created_at": "2018-05-08 15:24:06",
"app": {
"name": "App name",
"description": "App description",
"alias": "app_alias",
"created_at": "2018-05-08 15:24:04"
}
}
}
}
}
}
https://api.pushed.co/1/app/channel
PUT This method allows you to create a new channel.
Parameter Name Type Required Description pushed_id
string Yes Your account PushedID (you can get it from your account settings page ). api_key
string Yes Your account api key (you can get it from your account settings page ). app
string Yes App alias (where you want to create the child channel). name
string Yes App name. public
boolean Optional Wether your channel will be publicly available or not (Private by default ). icon_url
string Optional App icon url (will be saved to Pushed). members_only
integer Optional Wether the channel will be available for members only. Accepted values: 1
or 0
.
Sample Code: Command Line
Copy Codecurl -X PUT \
https://api.pushed.co/1/app/channel \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'pushed_id=user_pushed_id&api_key=user_api_key&app=alias_of_the_origin_app&name=name_of_the_channel&public=public_visibility&icon_url=url_of_the_icon'
use LWP::UserAgent;
LWP::UserAgent->new()->put(
"https://api.pushed.co/1/app/channel", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"app" => "alias_of_the_origin_app",
"name" => "name_of_the_channel",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app/channel",
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => array(
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"app" => "alias_of_the_origin_app",
"name" => "name_of_the_channel",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app/channel")
req = Net::HTTP::Put.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:app => "alias_of_the_origin_app",
:name => "name_of_the_channel",
:public => "public_visibility",
:icon_url => "url_of_the_icon"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('PUT', '/1/app/channel', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"app": "alias_of_the_origin_app",
"name": "name_of_the_channel",
"public": "public_visibility",
"icon_url": "url_of_the_icon"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"app": "alias_of_the_origin_app",
"name": "name_of_the_channel",
"public": "public_visibility",
"icon_url": "url_of_the_icon"
}
r = requests.put("https://api.pushed.co/1/app/channel", data=payload)
print(r.text)
https://api.pushed.co/1/app/channel
POST This method allows you to edit a channel.
Parameter Name Type Required Description app_key
string Yes Your application key. You can find your app_key
on the settings section of your application inside the developer portal . app_secret
string Yes Your application secret. You can find your app_secret
on the settings section of your application inside the developer portal . alias
string required Channel alias. name
string Yes App name. public
boolean Optional Wether your app will be publicly available or not (1
means public, 0
means private). icon_url
string Optional Channel icon url (will be saved to Pushed).
Sample Code: Command Line
Copy Codecurl -X POST -s \
--form-string "app_key=your_app_key" \
--form-string "app_secret=your_app_secret" \
--form-string "channel_alias=alias_of_the_channel" \
--form-string "name=name_of_the_app" \
--form-string "public=public_visibility" \
--form-string "icon_url=url_of_the_icon" \
https://api.pushed.co/1/channel
use LWP::UserAgent;
LWP::UserAgent->new()->post(
"https://api.pushed.co/1/channel", [
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"channel_alias" => "alias_of_the_channel",
"name" => "name_of_the_app",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/channel",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"app_key" => "your_app_key",
"app_secret" => "your_app_secret",
"channel_alias" => "alias_of_the_channel",
"name" => "name_of_the_app",
"public" => "public_visibility",
"icon_url" => "url_of_the_icon"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/channel")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:app_key => "your_app_key",
:app_secret => "your_app_secret",
:channel_alias => "alias_of_the_channel",
:name => "name_of_the_app",
:public => "public_visibility",
:icon_url => "url_of_the_icon"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('POST', '/1/channel', json.dumps({
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"channel_alias": "alias_of_the_channel",
"name": "name_of_the_app",
"public": "public_visibility",
"icon_url": "url_of_the_icon"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"app_key": "your_app_key",
"app_secret": "your_app_secret",
"channel_alias": "alias_of_the_channel",
"name": "name_of_the_app",
"public": "public_visibility",
"icon_url": "url_of_the_icon"
}
r = requests.post("https://api.pushed.co/1/channel", data=payload)
print(r.text)
https://api.pushed.co/1/app/channel
DELETE This method removes a channel.
Parameter Name Type Required Description pushed_id
string Yes Your account PushedID (you can get it from your account settings page ). api_key
string Yes Your account api key (you can get it from your account settings page ). channel_alias
string required Channel alias.
Sample Code: Command Line
Copy Codecurl -X DELETE -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "alias=alias_of_the_channel" \
https://api.pushed.co/1/app/channel
use LWP::UserAgent;
LWP::UserAgent->new()->delete(
"https://api.pushed.co/1/app/channel", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"alias" => "alias_of_the_channel"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/app/channel",
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => array(
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"alias" => "alias_of_the_channel"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/app/channel")
req = Net::HTTP::Delete.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:alias => "alias_of_the_channel"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('DELETE', '/1/app/channel', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"alias": "alias_of_the_channel"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"alias": "alias_of_the_channel"
}
r = requests.delete("https://api.pushed.co/1/app/channel", data=payload)
print(r.text)
Example of a valid channel
deletion response:
{
"response": {
"type": "channel_deleted_succesfully",
"message": "Channel (channel name) deleted successfully."
}
}
https://api.pushed.co/1/channel/subscriptions
GET This method retrieves channel subscriptions.
Parameter Name Type Required Description pushed_id
string Yes Your account PushedID (you can get it from your account settings page ). api_key
string Yes Your account api key (you can get it from your account settings page ). channel_alias
string required Channel alias.
Sample Code: Command Line
Copy Codecurl -X GET -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "channel_alias=alias_of_the_channel" \
https://api.pushed.co/1/channel/subscriptions
use LWP::UserAgent;
LWP::UserAgent->new()->get(
"https://api.pushed.co/1/channel/subscriptions", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"channel_alias" => "alias_of_the_channel"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/channel/subscriptions?pushed_id=user_pushed_id&api_key=user_api_key&channel_alias=alias_of_the_channel",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/channel/subscriptions")
req = Net::HTTP::Get.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:channel_alias => "alias_of_the_channel"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('GET', '/1/channel/subscriptions', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"channel_alias": "alias_of_the_channel"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"channel_alias": "alias_of_the_channel"
}
r = requests.get("https://api.pushed.co/1/channel/subscriptions", data=payload)
print(r.text)
Example of a valid channel subscriptions
response:
{
"response": {
"type": "subscribers_successfully_fetched",
"message": "Channel subscribers successfully fetched.",
"data": {
"subscriptions": [
{
"alias": "subscription_alias",
"email": "hello@pushed.co",
"subscribed_at": {
"date": "2018-08-30 12:13:44.000000",
"timezone_type": 3,
"timezone": "UTC"
}
},
]
}
}
}
https://api.pushed.co/1/channel/subscription
GET This method retrieves an specific channel subscription. You must send either subscription_alias
or subscription_email
in order to get the subscription data.
Parameter Name Type Required Description pushed_id
string Yes Your account PushedID (you can get it from your account settings page ). api_key
string Yes Your account api key (you can get it from your account settings page ). channel_alias
string required Channel alias. subscription_alias
string optional (one search needle required) Subscription alias. subscription_email
string optional (one search needle required) Subscription email.
Sample Code: Command Line
Copy Codecurl -X GET -s \
--form-string "pushed_id=user_pushed_id" \
--form-string "api_key=user_api_key" \
--form-string "subscription_alias=alias_of_the_subscription" \
--form-string "subscription_email=email_of_the_subscription" \
https://api.pushed.co/1/channel/subscription
use LWP::UserAgent;
LWP::UserAgent->new()->get(
"https://api.pushed.co/1/channel/subscription", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"subscription_alias" => "alias_of_the_subscription",
"subscription_email" => "email_of_the_subscription"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/channel/subscription?pushed_id=user_pushed_id&api_key=user_api_key&subscription_alias=alias_of_the_subscription&subscription_email=email_of_the_subscription",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/channel/subscription")
req = Net::HTTP::Get.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:subscription_alias => "alias_of_the_subscription",
:subscription_email => "email_of_the_subscription"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('GET', '/1/channel/subscription', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"subscription_alias": "alias_of_the_subscription",
"subscription_email": "email_of_the_subscription"
}
r = requests.get("https://api.pushed.co/1/channel/subscription", data=payload)
print(r.text)
Example of a valid channel subscription
response:
{
"response": {
"type": "subscription_successfully_fetched",
"message": "Channel subscription successfully fetched.",
"data": {
"subscription": {
"alias": "subscription_alias",
"email": "hello@pushed.co",
"subscribed_at": {
"date": "2018-05-08 15:24:08.000000",
"timezone_type": 3,
"timezone": "UTC"
}
}
}
}
}
Account Management
# account
https://api.pushed.co/1/account PUT This method allows you to programatically create a new account in Pushed and then subscribe to the selected app or channel.
Parameter Name Type Required Description pushed_id
string yes Your account PushedID (you can get it from your account settings page ). api_key
string yes Your account api key (you can get it from your account settings page ). email
string Yes The email of the new account. password
string Yes The password of the new account. Minimum lentgh: 8 subscribe_to_alias
string Yes The alias of your source (can be an app or a channel). subscribe_to_type
string Yes The type of your source (app or channel). timezone
string No A valid timezone. List of supported timezones .
Example of a valid
account
response for adding new account:
{
"response": {
"type": "account_successfully_added",
"message": "Account successfully added.",
"data": {
{
"alias": "Drc37p"
}
}
}
}
Sample Code: Command Line
Copy Codecurl -X PUT \
https://api.pushed.co/1/account \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'pushed_id=user_pushed_id&api_key=user_api_key&email=john%40doe.com&password=secret1234&subscribe_to_alias=your_app_or_channel_alias&subscribe_to_type=your_source_type'
use LWP::UserAgent;
LWP::UserAgent->new()->put(
"https://api.pushed.co/1/account", [
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"email" => "john@doe.com",
"password" => "secret1234",
"subscribe_to_alias" => "your_app_or_channel_alias",
"subscribe_to_type" => "your_source_type"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/account",
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => array(
"pushed_id" => "user_pushed_id",
"api_key" => "user_api_key",
"email" => "john@doe.com",
"password" => "secret1234",
"subscribe_to_alias" => "your_app_or_channel_alias",
"subscribe_to_type" => "your_source_type"
),
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/account")
req = Net::HTTP::Put.new(url.path)
req.set_form_data({
:pushed_id => "user_pushed_id",
:api_key => "user_api_key",
:email => "john@doe.com",
:password => "secret1234",
:subscribe_to_alias => "your_app_or_channel_alias",
:subscribe_to_type => "your_source_type"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('PUT', '/1/account', json.dumps({
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"email": "john@doe.com",
"password": "secret1234",
"subscribe_to_alias": "your_app_or_channel_alias",
"subscribe_to_type": "your_source_type"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"pushed_id": "user_pushed_id",
"api_key": "user_api_key",
"email": "john@doe.com",
"password": "secret1234",
"subscribe_to_alias": "your_app_or_channel_alias",
"subscribe_to_type": "your_source_type"
}
r = requests.put("https://api.pushed.co/1/account", data=payload)
print(r.text)
# account
https://api.pushed.co/1/account GET This method allows you to programatically fetch an account basic data in Pushed. To use this method you need an OAuth access token. Learn More .
Example of a valid
account
response for fetching account data:
{
"response": {
"type": "account_successfully_fetched",
"message": "Account successfully fetched.",
"data": {
{
"account": {
"email": "hello@pushed.co",
"alias": "0Phlh9",
"timezone": "UTC",
"language": "en"
}
}
}
}
}
Sample Code: Command Line
Copy Codecurl -X GET -s \
--form-string "access_token=access_token_code_given_by_pushed" \
https://api.pushed.co/1/account
use LWP::UserAgent;
LWP::UserAgent->new()->get(
"https://api.pushed.co/1/account", [
"access_token" => "access_token_code_given_by_pushed"
]);
curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushed.co/1/account?access_token=access_token_code_given_by_pushed",
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_SAFE_UPLOAD => true,
CURLOPT_RETURNTRANSFER => true
));
curl_exec($ch);
curl_close($ch);
require "net/https"
url = URI.parse("https://api.pushed.co/1/account")
req = Net::HTTP::Get.new(url.path)
req.set_form_data({
:access_token => "access_token_code_given_by_pushed"})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }
#!/usr/bin/python
import json,httplib
connection = httplib.HTTPSConnection('api.pushed.co', 443)
connection.connect()
connection.request('GET', '/1/account', json.dumps({
"access_token": "access_token_code_given_by_pushed"}),
{
"Content-Type": "application/json"
}
)
result = json.loads(connection.getresponse().read())
print result
#!/usr/bin/python
import requests
payload = {
"access_token": "access_token_code_given_by_pushed"
}
r = requests.get("https://api.pushed.co/1/account", data=payload)
print(r.text)
Analytics
Available soon.
Lastest Update: Mon, 11 Nov 2024 10:17:40