Primeiramente você deve gerar uma API Key e API Secret, veja como em
Gerando uma API Key e Secret (Chaves de Autenticação)Veja mais informações em
Acessando as APIs do Pulpo1. Utilizando a SDK
import { getHttpSdk } from '@pulpo/sdk/http';
// troque $env pelo nome de seu ambiente no Droz Base
const pulpo = getHttpSdk("https://$env.pulpo.services", "Basic " + token);
const { findAnswer } = await pulpo.findAnswer({
query: String,
parent: String,
cacheOnly: Boolean,
});
console.log(findAnswer);Exemplo de resposta da API Graphql:
{
"findAnswer": {
"answer": "A internet é uma rede mundial que tem como objetivo interligar computadores para fornecer ao usuário o acesso a diversas informações.",
"record": {
"slug": "docs/Conceitos-tecnicos-p0gsb17bm36htc81pg4cyneamt",
"title": "Conceitos técnicos ",
}
}
}2. Utilizando Requests HTTP
curl --location --request POST 'https://origin.pulpo.services/graphql' \
--header "Authorization: Bearer $token" \
--header "Content-Type: application/json" \
--data-raw '{"query":"query findAnswer { findAnswer(query: \"o que é internet?\") { answer }}"}'