Pular para o conteúdo principal
POST
/
api
/
v1
/
accounts
/
{account_id}
/
portals
/
{id}
/
articles
Adicionar um novo article
curl --request POST \
  --url https://airys.chat/api/v1/accounts/{account_id}/portals/{id}/articles \
  --header 'Content-Type: application/json' \
  --header 'api_access_token: <api-key>' \
  --data '
{
  "title": "Article Title",
  "slug": "article-title",
  "position": 1,
  "content": "This is the content of the article",
  "description": "This is the description of the article",
  "category_id": 1,
  "author_id": 1,
  "associated_article_id": 2,
  "status": 1,
  "locale": "en",
  "meta": {
    "tags": [
      "article_name"
    ],
    "title": "article title",
    "description": "descrição do artigo"
  }
}
'
import requests

url = "https://airys.chat/api/v1/accounts/{account_id}/portals/{id}/articles"

payload = {
"title": "Article Title",
"slug": "article-title",
"position": 1,
"content": "This is the content of the article",
"description": "This is the description of the article",
"category_id": 1,
"author_id": 1,
"associated_article_id": 2,
"status": 1,
"locale": "en",
"meta": {
"tags": ["article_name"],
"title": "article title",
"description": "descrição do artigo"
}
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Article Title',
slug: 'article-title',
position: 1,
content: 'This is the content of the article',
description: 'This is the description of the article',
category_id: 1,
author_id: 1,
associated_article_id: 2,
status: 1,
locale: 'en',
meta: {
tags: ['article_name'],
title: 'article title',
description: 'descrição do artigo'
}
})
};

fetch('https://airys.chat/api/v1/accounts/{account_id}/portals/{id}/articles', 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://airys.chat/api/v1/accounts/{account_id}/portals/{id}/articles",
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([
'title' => 'Article Title',
'slug' => 'article-title',
'position' => 1,
'content' => 'This is the content of the article',
'description' => 'This is the description of the article',
'category_id' => 1,
'author_id' => 1,
'associated_article_id' => 2,
'status' => 1,
'locale' => 'en',
'meta' => [
'tags' => [
'article_name'
],
'title' => 'article title',
'description' => 'descrição do artigo'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_access_token: <api-key>"
],
]);

$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://airys.chat/api/v1/accounts/{account_id}/portals/{id}/articles"

payload := strings.NewReader("{\n \"title\": \"Article Title\",\n \"slug\": \"article-title\",\n \"position\": 1,\n \"content\": \"This is the content of the article\",\n \"description\": \"This is the description of the article\",\n \"category_id\": 1,\n \"author_id\": 1,\n \"associated_article_id\": 2,\n \"status\": 1,\n \"locale\": \"en\",\n \"meta\": {\n \"tags\": [\n \"article_name\"\n ],\n \"title\": \"article title\",\n \"description\": \"descrição do artigo\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("api_access_token", "<api-key>")
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://airys.chat/api/v1/accounts/{account_id}/portals/{id}/articles")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Article Title\",\n \"slug\": \"article-title\",\n \"position\": 1,\n \"content\": \"This is the content of the article\",\n \"description\": \"This is the description of the article\",\n \"category_id\": 1,\n \"author_id\": 1,\n \"associated_article_id\": 2,\n \"status\": 1,\n \"locale\": \"en\",\n \"meta\": {\n \"tags\": [\n \"article_name\"\n ],\n \"title\": \"article title\",\n \"description\": \"descrição do artigo\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://airys.chat/api/v1/accounts/{account_id}/portals/{id}/articles")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"Article Title\",\n \"slug\": \"article-title\",\n \"position\": 1,\n \"content\": \"This is the content of the article\",\n \"description\": \"This is the description of the article\",\n \"category_id\": 1,\n \"author_id\": 1,\n \"associated_article_id\": 2,\n \"status\": 1,\n \"locale\": \"en\",\n \"meta\": {\n \"tags\": [\n \"article_name\"\n ],\n \"title\": \"article title\",\n \"description\": \"descrição do artigo\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "content": "<string>",
  "meta": {},
  "position": 123,
  "title": "<string>",
  "slug": "<string>",
  "views": 123,
  "portal_id": 123,
  "account_id": 123,
  "author_id": 123,
  "category_id": 123,
  "folder_id": 123,
  "associated_article_id": 123
}
{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}

Autorizações

api_access_token
string
header
obrigatório

Este token pode ser obtido visitando a página de perfil ou por meio do console rails. Fornece acesso a endpoints com base nos níveis de permissões do usuário. Este token pode ser salvo por um sistema externo quando o usuário é criado via API, para realizar atividades em nome do usuário.

Parâmetros de caminho

account_id
integer
obrigatório

O ID numérico da conta

id
string
obrigatório

O identificador de slug do portal

Corpo

application/json
title
string

O título do artigo

Exemplo:

"Article Title"

slug
string

O slug do artigo

Exemplo:

"article-title"

position
integer

posição do artigo na categoria

Exemplo:

1

content
string

O conteúdo do texto.

Exemplo:

"This is the content of the article"

description
string

A descrição do artigo

Exemplo:

"This is the description of the article"

category_id
integer

O id da categoria do artigo

Exemplo:

1

author_id
integer

O id do agente autor do artigo

Exemplo:

1

associated_article_id
integer

Para associar artigos semelhantes entre si, por exemplo, para fornecer o link para a referência.

Exemplo:

2

status
integer

O status do artigo. 0 para rascunho, 1 para publicado, 2 para arquivado

Exemplo:

1

locale
string

A localidade do artigo

Exemplo:

"en"

meta
object

Usar para pesquisa

Exemplo:
{
"tags": ["article_name"],
"title": "article title",
"description": "descrição do artigo"
}

Resposta

Sucesso

id
integer
content
string

O conteúdo do texto.

meta
object
position
integer
status
enum<integer>
Opções disponíveis:
draft,
published,
archived
title
string
slug
string
views
integer
portal_id
integer
account_id
integer
author_id
integer
category_id
integer
folder_id
integer
associated_article_id
integer

Para associar artigos semelhantes entre si, por exemplo, para fornecer o link para a referência.