curl --request PATCH \
--url https://snapwidget.com/api/v1/widgets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"layout": "<string>",
"settings": {},
"accounts": [
123
],
"campaign_id": 123,
"name": "<string>",
"source_ids": [
"<string>"
]
}
'import requests
url = "https://snapwidget.com/api/v1/widgets/{id}"
payload = {
"layout": "<string>",
"settings": {},
"accounts": [123],
"campaign_id": 123,
"name": "<string>",
"source_ids": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
layout: '<string>',
settings: {},
accounts: [123],
campaign_id: 123,
name: '<string>',
source_ids: ['<string>']
})
};
fetch('https://snapwidget.com/api/v1/widgets/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'layout' => '<string>',
'settings' => [
],
'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/{id}"
payload := strings.NewReader("{\n \"layout\": \"<string>\",\n \"settings\": {},\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://snapwidget.com/api/v1/widgets/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"layout\": \"<string>\",\n \"settings\": {},\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/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"layout\": \"<string>\",\n \"settings\": {},\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>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}Update Widget
Changes a widget; send only what changes. A refused call changes nothing. A social widget: its name, layout, settings (the names in get_widget’s settings; list_widget_types gives each setting’s allowed values), its accounts (all of them, in order: the first, of the widget’s service, gives the header) and its campaign (for the “hashtag-campaign” filter; a widget that leaves its campaign needs its accounts in the same call). A review widget: its name, layout, settings and review sources. The site shows a change within a few minutes. embed_code_changed true (for example a new size of a widget with a fixed width and height) on a widget that is already on a site: give the user the new embed_code and the steps of get_embed_code to replace the code on the site.
curl --request PATCH \
--url https://snapwidget.com/api/v1/widgets/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"layout": "<string>",
"settings": {},
"accounts": [
123
],
"campaign_id": 123,
"name": "<string>",
"source_ids": [
"<string>"
]
}
'import requests
url = "https://snapwidget.com/api/v1/widgets/{id}"
payload = {
"layout": "<string>",
"settings": {},
"accounts": [123],
"campaign_id": 123,
"name": "<string>",
"source_ids": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
layout: '<string>',
settings: {},
accounts: [123],
campaign_id: 123,
name: '<string>',
source_ids: ['<string>']
})
};
fetch('https://snapwidget.com/api/v1/widgets/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'layout' => '<string>',
'settings' => [
],
'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/{id}"
payload := strings.NewReader("{\n \"layout\": \"<string>\",\n \"settings\": {},\n \"accounts\": [\n 123\n ],\n \"campaign_id\": 123,\n \"name\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://snapwidget.com/api/v1/widgets/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"layout\": \"<string>\",\n \"settings\": {},\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/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"layout\": \"<string>\",\n \"settings\": {},\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>"
}{
"message": "<string>",
"errors": {},
"upgrade_url": "<string>"
}Authorizations
A token from the API page: https://snapwidget.com/settings/api
Path Parameters
The widget's id (the id in list_widgets).
Body
A new layout of the same kind. A social widget keeps its service and plan.
The settings to change, as {name: value}, for example {"layoutx": 4, "layouty": 2, "name": "Home page feed"}.
Social widget: all its account ids from list_accounts, in order, in place of the current ones.
Social widget: one of the user's campaigns (list_campaigns), with the setting filter_type "hashtag-campaign".
The widget's name in the Widgets list.
Review widget: all its review source ids from list_review_sources, in place of the current ones.
Response
The answer, as JSON.
The response is of type object.