API to load pdf file from a url, store it in the local storage, generate the thumbnail of the pdf and send a webhook to the api client.
-
Add pdf document by url
-
Detect pdf files duplicate
-
Show the pdf list and associated thumbnails
-
Download pdf document
-
Download pdf document thumbnail
-
Show pdf document infos by id
-
Show pdf document infos by name
-
Consume webhook event
-
From node v18.16.0
-
From npm 9.6.6
-
From Typescript v5.0.4
-
IDE: VSCode or Webstorm
-
Thunder client: extension of VSCode to import the collection of API endpoints and test easily (File to import upflow-api\thunder-collection_upflow-api.json)
1. Clone the API
git clone https://github.com/soumgraphic/upflow-api.git
2. Install dependencies
npm install
Globally with TypeScript
npm install -g typescript
npm install -g ts-node
4. Run the app using npm in dev
npm run build
npm run dev
The app will start running at http://localhost:3000/api/v1/
5. Run the app using npm in another environment
npm run build
npm start
The API defines following endpoints.
Method | Url | Decription | Sample JSON Request Body |
---|---|---|---|
POST | /api/v1/documents | Add pdf document by url | JSON |
GET | /api/v1/documents | Show the pdf list and thumbnails | |
GET | /api/v1/documents/:id/view | Download pdf document | |
GET | /api/v1/documents/:id/thumbnail | Download pdf document thumbnail | |
GET | /api/v1/documents/:id | Show pdf document infos by id | |
GET | /api/v1/documents?name=:doc-name | Show pdf document infos by name |
Method | Url | Decription | Sample JSON Request Body |
---|---|---|---|
POST | /api/v1/webhooks | Consume webhook event | JSON |
{
"docUrl": "https://about.gitlab.com/images/press/git-cheat-sheet.pdf",
"owner": "john.doe@gmail.com"
}
{
"eventType": "pdf.processing",
"eventId": "evt-512ce108-0d88-476f-9087-f7b99512902c",
"payload": {
"id": "0a2926c5-7dfa-4243-ac5f-bbbb830d8393",
"documentName": "git-cheat-sheet-education.pdf",
"status": "completed",
"message": "PDF processing completed successfully"
}
}
- https://johndecember.com/html/spec/HTML5-Cheat-Sheet.pdf
- https://html.com/wp-content/uploads/html-cheat-sheet.pdf
Made with love ❤️ by : @Soumaila Abdoulaye DIARRA