This documentation has all the routes that exist in this application, in addition to having all the necessary parameters for each route.
To consume the API in the development environment, first of all, you need an account on the smmry.com website so that you can create your API key for consuming the API on your local machine.
Having your API KEY in hand, create an .env file with the variable SMMRY_API_KEY with the value of your generated API KEY. Also, add a PORT variable with the port number that the application should run and the APPLICATION_URL variable with the value of the URL that the application can access, for example, http://localhost:3000 (do not put the slash at the end of the URL).
By following the steps given above, you will be able to test this API on your local machine.
IMPORTANT!!!: This application was in production. However, after problems with domain and deployment, it was temporarily removed from the air. It will soon be back for public use.
If you notice any problems with this documentation, please report them as soon as possible to correct them.
From this part of the documentation, the information of each route of this application will be passed in detail.
Name | Type | Example | Required |
No Params |
Name | Type | Example | Required |
No Body Params |
Status Code | Return Type | Return |
200 (Success) | JSON | Application creator message |
const URL = 'https://api-mysummary.herokuapp.com'
fetch(URL).then(response => {
response.json().then(data => {
console.log(data)
/**
* @returns
* { message: 'This is an automatic PDF generation API created by Renato Pereira. Visit my Github: https://github.com/renato3x/' }
*/
})
})
Name | Type | Example | Required |
pdfName | String | 1629767554357-my_pdf_file.pdf | Yes |
Name | Type | Example | Required |
No Body Params |
Status Code | Return Type | Return |
200 (Success) | PDF File | PDF Data |
404 (Not Found) | HTML File | Cannot GET /pdfs/anything_you_wrote_here |
const URL = 'https://api-mysummary.herokuapp.com/pdfs/1629767554357-my_pdf_file.pdf'
fetch(URL).then(response => {
response.json().then(data => {
console.log(data)
/**
* @returns
* The HTML File you requested or
* Cannot GET /pdfs/1629767554357-my_pdf_file.pdf
*/
})
})
Name | Type | Example | Required |
No Params |
Name | Type | Example | Required |
pdfTitle | String | Title Of My PDF | Yes |
url | String | https://website-for-create-summary.com | Yes |
Status Code | Return Type | Return |
201 (Created) | JSON | URL to access the generated PDF |
400 (Bad Request) | JSON | Message: Invalid page to create a summary |
500 (Internal Server Error) | JSON | Message: Error generating summary |
500 (Internal Server Error) | JSON | Message: Error generating pdf file |
429 (Too Many Requests) | JSON | Message: Too many requests. Please, wait a little bit (try again after 1 minute) |
const URL = 'https://api-mysummary.herokuapp.com/pdf'
fetch(URL, {
method: 'POST',
body: {
pdfTitle: 'My PDF',
url: 'https://my-url.com'
},
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
}).then(response => {
response.json().then(data => {
console.log(data)
})
})
Using Socket.io, this API can emit real-time events for interaction mainly in Frontend.
To use this feature, use the Socket.io client. Look for the Socket.io client package for your application (React, Vue, Angular or even without these frameworks) and install it in your application. Once that's done, connect Socket.io to the API using the web URL (https://api-mysummary.herokuapp.com) or your machine's URL local.
Having connected socket.io to the API, just listen for the emitted events. Events sent to the API consumer are listed below:
Name | Type | Description |
requestQuantity | Number | Returns the number of requests made in the day. A number ranging from 0 to 100 |
canRequest | Boolean | Returns if it is still possible to generate files on the same day |
io.on('requestQuantity', (data) => {
console.log(`Quantity of archives made today: ${data.requestQuantity}`)
console.log(`Can files still be made today? ${data.canRequest ? 'Yes!' : 'No!'}`)
})