Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!