POST/api/v4/social/brands

Crea un brand

Crea un brand social che contiene gli account social collegati e i relativi post pubblicati. I brand sono illimitati nei piani API.

Richiede una chiave API. Consulta Autenticazione per il formato dell’header e la rotazione delle chiavi.

Parametri

Corpo

NomeTipoObbligatorioDescrizione
inputobjectobbligatorioWrapper object. Every field below is a property of `input`, the entire body must be nested under it.
input.profileNamestringobbligatorioDisplay name of the brand. Shown wherever the brand is listed and used as the default author name in the composer.
input.timezoneobjectobbligatorioThe brand's timezone as `{ label, tzCode, name, utc }`, all strings. `tzCode` is the one that matters: it is the IANA identifier the API validates and uses to interpret every `scheduleDate` / `scheduleTime` on this brand's posts. The other three are display labels.
input.businessIntentstringfacoltativoOne or two sentences describing what the business does, used to tailor content suggestions. Defaults to `general` when omitted.
input.categoriesarray of stringsfacoltativoBusiness categories for the brand, e.g. `["Furniture Store"]`. Defaults to an empty list.
input.siteUrlstringfacoltativoThe brand's website. Used to enrich content suggestions; setting it also queues a one-off read of the site.
input.logostringfacoltativoPublic https URL of the brand logo.
input.countryIsostringfacoltativoTwo-letter ISO country code for the brand, e.g. `US`.
input.biostringfacoltativoShort brand bio.
input.brandHashtagsarray of stringsfacoltativoHashtags that belong to the brand, offered as suggestions in the composer.
input.competitorHashtagsarray of stringsfacoltativoCompetitor hashtags to track alongside the brand's own.
input.contentPreferredLanguagestringfacoltativoPreferred language for generated content, e.g. `en`.

Richiesta di esempio

Corpo pronto da incollare. Sostituisci gli ID e i valori segnaposto con i tuoi.

Request body
{  "input": {    "profileName": "Jenny Home",    "timezone": {      "label": "(GMT-05:00) Eastern Time",      "tzCode": "America/New_York",      "name": "Eastern Standard Time",      "utc": "-05:00"    },    "businessIntent": "A family-run home furnishings store selling handmade furniture and textiles.",    "categories": ["Furniture Store", "Home Goods"],    "siteUrl": "https://jennyhome.example",    "countryIso": "US",    "bio": "Handmade furniture for real homes.",    "brandHashtags": ["jennyhome", "handmadefurniture"]  }}

Risposte

200Brand created. `socialProfile.id` is the `brandId` every other Social endpoint takes.
Response
{  "data": {    "createSocialProfile": {      "success": true,      "error": null,      "socialProfile": {        "id": "6f2c9a41-7b0e-4d55-9a2f-3c8e1d47b902",        "profileName": "Jenny Home",        "archived": false,        "logo": null,        "profileLogo": null,        "siteUrl": "https://jennyhome.example",        "countryIso": "US",        "bio": "Handmade furniture for real homes.",        "businessIntent": "A family-run home furnishings store selling handmade furniture and textiles.",        "categories": ["Furniture Store", "Home Goods"],        "brandHashtags": ["jennyhome", "handmadefurniture"],        "competitorHashtags": [],        "connectedChannelCount": 0,        "timezone": {          "label": "(GMT-05:00) Eastern Time",          "tzCode": "America/New_York",          "name": "Eastern Standard Time",          "utc": "-05:00"        },        "contentPreferredLanguage": "en"      }    }  }}
200Validation failed. The status is still 200: read `success`.
Response
{  "data": {    "createSocialProfile": {      "success": false,      "error": {        "message": "SY90003: timezone.tzCode is not a valid IANA identifier",        "code": "SY90003",        "contextInfo": null      },      "socialProfile": null    }  }}
401Unauthenticated, missing or invalid API key.

Crea un brand: l'oggetto di primo livello della Social API. A un brand appartengono gli account social che vi colleghi e ogni post pubblicato da questi account. Non puoi effettuare altre chiamate alla Social API finché non esiste almeno un brand, quindi questa è la prima richiesta di qualsiasi integrazione Social.

Caso d'uso: configurare la pubblicazione sui social per un cliente. Quando un cliente si registra nel tuo prodotto, crea un brand per ogni attività per cui vuole pubblicare. Memorizza il valore socialProfile.id restituito nel tuo record di quell'attività: è il token di percorso brandId in POST /social/brands/{brandId}/connections/link e GET /social/brands/{brandId}/posts, e il campo socialProfileId nel corpo di ogni post che crei. Poi indirizza l'utente al link di collegamento ospitato per ogni piattaforma su cui vuole pubblicare.

Note.

  • Il corpo della richiesta deve essere racchiuso in un oggetto input. Ogni operazione di scrittura nella Social API usa questa struttura, con una sola eccezione: il link di collegamento accetta un corpo senza oggetto contenitore.
  • Controlla success, non lo stato HTTP. Un errore di validazione — un valore profileName mancante o un valore timezone.tzCode sconosciuto — restituisce HTTP 200 con success: false e il motivo in error. Considera la chiamata riuscita solo quando success è true.
  • Solo profileName e timezone sono obbligatori. businessIntent e categories hanno come valori predefiniti rispettivamente general e un elenco vuoto, quindi un'integrazione che non ha un equivalente di questi campi può ometterli del tutto.
  • timezone.tzCode non è un elemento decorativo. Un post programmato con scheduleDate + scheduleTime viene interpretato nel fuso orario del brand, non in quello di chi effettua la chiamata né in UTC. Modificarlo in seguito non cambia l'orario dei post già programmati.
  • Il brand appartiene sempre all'account associato alla chiave API. Non è possibile creare un brand in un altro account: qualsiasi identificatore di account presente nel corpo viene ignorato.
  • Gli ID dei brand sono semplici UUID. Non sono gli ID relay in Base64 usati da Locations e dai Posts delle sedi, quindi non codificarli né decodificarli. Lo stesso ID compare come token di percorso brandId e come campo socialProfileId nel corpo: brandId è sempre e solo un token dell'URL, mai un campo del corpo.
  • Un piano API non prevede alcun limite al numero di brand. I brand sono illimitati e non vengono conteggiati ai fini dell'utilizzo, quindi questa chiamata non viene mai rifiutata per il raggiungimento di un limite e non devi verificare la capacità residua prima di crearne uno. A essere conteggiati sono i collegamenti — un account social collegato a un brand su una rete. Consulta Piani e componenti aggiuntivi per le fasce di collegamenti e il prezzo di un pacchetto di collegamenti, e GET /social/limits per verificare quanti collegamenti puoi ancora creare prima di indirizzare un utente a un link di collegamento.

Operazione di scrittura: non eseguita sull'account reale. La richiesta e la risposta mostrate sono costruite a partire dallo schema API.

Request
curl -X POST 'https://listingsapi.com/api/v4/social/brands' \  -H "Authorization: API $LISTINGSAPI_KEY" \  -H 'Content-Type: application/json' \  -d '{    "input": {      "profileName": "Jenny Home",      "timezone": {        "label": "(GMT-05:00) Eastern Time",        "tzCode": "America/New_York",        "name": "Eastern Standard Time",        "utc": "-05:00"      },      "businessIntent": "A family-run home furnishings store selling handmade furniture and textiles.",      "categories": [        "Furniture Store",        "Home Goods"      ],      "siteUrl": "https://jennyhome.example",      "countryIso": "US",      "bio": "Handmade furniture for real homes.",      "brandHashtags": [        "jennyhome",        "handmadefurniture"      ]    }  }'