Adicionar um novo article
Adicionar um novo artigo ao portal
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
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
O ID numérico da conta
O identificador de slug do portal
Corpo
O título do artigo
"Article Title"
O slug do artigo
"article-title"
posição do artigo na categoria
1
O conteúdo do texto.
"This is the content of the article"
A descrição do artigo
"This is the description of the article"
O id da categoria do artigo
1
O id do agente autor do artigo
1
Para associar artigos semelhantes entre si, por exemplo, para fornecer o link para a referência.
2
O status do artigo. 0 para rascunho, 1 para publicado, 2 para arquivado
1
A localidade do artigo
"en"
Usar para pesquisa
{
"tags": ["article_name"],
"title": "article title",
"description": "descrição do artigo"
}Resposta
Sucesso
O conteúdo do texto.
draft, published, archived Para associar artigos semelhantes entre si, por exemplo, para fornecer o link para a referência.
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>"
}
]
}