Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

103
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda