Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

102
Visualizações
How do I pass Text instead of URL in the Smmry API?

this is a very specific questions so I am not sure if there is anyone that can answer, but I have to try anyway. So the reddit tldr bot uses the Smmry API to summarize content. I am trying to make something similar. The problem is in the documentation it only shows URLs as a possible parameter. Does anyone know how I could just pass a string of text?
I tried emailing them but got no response.

The home page of Smmry lets you pass just text so I am sure you can do it, There is also an example in PHP but I have 0 knowledge of PHP. Here is their PHP example:

$text = "Your long text goes here...";

$ch = curl_init("https://api.smmry.com/&SM_API_KEY=X");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:")); // See Note
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "sm_api_input=".$text);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$return = json_decode(curl_exec($ch), true);
curl_close($ch); 

Here is the sample code I am using for the request in javascript. YOURKEY is a placeholder for the key each person gets.

const axios = require('axios')

axios.post('https://api.smmry.com?SM_API_KEY=YOURKEY', {
})
    .then(function (response) {
        console.log(response.data.sm_api_content);
    })
    .catch(function (error) {
        console.log(error);
    });
almost 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Pass the string you would like to summarize as a key=pair value as a single string.

The added headers mimic the example in the API docs.

const axios = require('axios');

const text = 'A very long text to summarize..';

axios.post(
  'https://api.smmry.com?SM_API_KEY=YOURKEY', 
  `sm_api_input=${text}`, 
  {
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Expect': '100-continue'
    }
  }
)
.then(function (response) {
  console.log(response.data.sm_api_content);
})
.catch(function (error) {
  console.log(error);
});
almost 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda