curl --request POST \
--url https://snapwidget.com/api/v1/widgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"layout": "<string>",
"accounts": [
123
],
"campaign_id": 123,
"name": "<string>",
"source_ids": [
"<string>"
]
}
'import requests
url = "https://snapwidget.com/api/v1/widgets"
payload = {
"layout": "<string>",
"accounts": [123],
"campaign_id": 123,
"name": "<string>",
"source_ids": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
layout: '<string>',
accounts: [123],
campaign_id: 123,
name: '<string>',
source_ids: ['<string>']
})
};
fetch('https://snapwidget.com/api/v1/widgets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://snapwidget.com/api/v1/widgets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'layout' => '<string>',
'accounts' => [
123
],
'campaign_id' => 123,
'name' => '<string>',
'source_ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://snapwidget.com/api/v1/widgets"
payload := strings.NewReader("{\n \"layout\": \"<string>\",\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://snapwidget.com/api/v1/widgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"layout\": \"<string>\",\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://snapwidget.com/api/v1/widgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"layout\": \"<string>\",\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}Create Widget
Makes a widget. A social widget: a layout and the user’s accounts from list_accounts (the first account gives the widget its service and header; the others add their posts), or one of the user’s hashtag campaigns. A review widget: kind “review”, a name, a layout and review sources; it shows only the reviews that are not hidden or pending (the “shown” count in list_review_sources), and the answer’s reviews_shown says how many it shows. The answer is the widget as get_widget gives it; change its settings with update_widget, then use get_embed_code to put it on a site. A new pro widget counts for the plan’s widget limit.
curl --request POST \
--url https://snapwidget.com/api/v1/widgets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"layout": "<string>",
"accounts": [
123
],
"campaign_id": 123,
"name": "<string>",
"source_ids": [
"<string>"
]
}
'import requests
url = "https://snapwidget.com/api/v1/widgets"
payload = {
"layout": "<string>",
"accounts": [123],
"campaign_id": 123,
"name": "<string>",
"source_ids": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
layout: '<string>',
accounts: [123],
campaign_id: 123,
name: '<string>',
source_ids: ['<string>']
})
};
fetch('https://snapwidget.com/api/v1/widgets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://snapwidget.com/api/v1/widgets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'layout' => '<string>',
'accounts' => [
123
],
'campaign_id' => 123,
'name' => '<string>',
'source_ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://snapwidget.com/api/v1/widgets"
payload := strings.NewReader("{\n \"layout\": \"<string>\",\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://snapwidget.com/api/v1/widgets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"layout\": \"<string>\",\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://snapwidget.com/api/v1/widgets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"layout\": \"<string>\",\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}Authorizations
A token from the API page: https://snapwidget.com/settings/api
Body
The layout: a social one from list_widget_types (for example grid, slideshow, board, feed, scrolling, popup), or a review one (wall, carousel, marquee, list, badge, avatars).
"social" (posts of accounts or a campaign) or "review" (reviews). Not sent: social.
social, review Social widget: the account ids from list_accounts, in order. The first gives the widget its service; at most the plan's accounts per widget (get_account).
Social widget: one of the user's campaigns (list_campaigns) in place of accounts. Instagram, Pro plans.
The widget's name in the Widgets list (a review widget needs it).
Review widget: the review source ids from list_review_sources. Not sent: all the user's sources.
Response
The answer, as JSON.
The response is of type object.