Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>API</title>
- <link rel="stylesheet" type="text/css" href="/stylesheets/style_new.css">
- <link rel="stylesheet" type="text/css"
- href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.9.0/github-markdown.min.css">
- <meta name="description" content="API of this service">
- <meta name="author" content="Danil Kazimirov">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <body>
- <header class="publication-header">
- <div class="header-title">
- <p>API</p>
- </div>
- </header>
- <div class="shadow-box-out">
- <div class="content-text publication-info">
- <div class="reset markdown-body">
- <h1>0. Errors</h1>
- <ul>
- <li>If your request is bad, you will get next</li>
- </ul>
- <h3>response:</h3>
- <pre><code>{
- success:false,
- message:String
- }
- </code></pre>
- <h1>1. Auth</h1>
- <ul>
- <li>
- <h1><strong>Login</strong></h1>
- </li>
- </ul>
- <p><code>post(/api/v1/auth/login)</code></p>
- <h3>request:</h3>
- <pre><code>{
- email:String,
- password:String
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- email:String,
- tokens:
- [
- access:String,
- refresh:String
- ]
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Register</strong></h1>
- </li>
- </ul>
- <p><code>post(/api/v1/auth/register)</code></p>
- <h3>request:</h3>
- <pre><code>{
- email:String,
- password:String,
- fullname:String,
- telegram{optional}:String
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- tokens:
- [
- access:String,
- refresh:String
- ]
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Logout</strong></h1>
- </li>
- </ul>
- <p><code>post(/api/v1/auth/logout)</code></p>
- <h3>request:</h3>
- <pre><code>{
- {SEND BEARER AUTHORIZATION HEADER}
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Get new access token</strong></h1>
- </li>
- </ul>
- <p><code>post(/api/v1/auth/token)</code></p>
- <h3>request:</h3>
- <pre><code>{
- {SEND BEARER AUTHORIZATION HEADER}
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- tokens:String
- }
- </code></pre>
- <h2>2. Publications</h2>
- <ul>
- <li>
- <h1><strong>Search</strong></h1>
- </li>
- </ul>
- <p><code>get(/api/v1/publications)</code></p>
- <p>request (use URL-encoded request):</p>
- <pre><code>page:Number(>0) (optinal)
- limit:Number(>0) (optinal)
- title:String (optinal)
- author:String (optinal)
- tags:["String"] (optinal)
- id:String (optinal)
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- query:String [computed search query],
- page: Number,
- total: Number,
- limit: Number,
- pager: Number,
- items:
- [
- {
- title: String,
- author_id: String,
- image_id: String,
- text: String,
- description: String,
- id: String,
- createdAt: String,
- tags: [String],
- difficult: Number
- }
- ]
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Delete</strong></h1>
- </li>
- </ul>
- <p><code>delete(/api/v1/publications)</code></p>
- <h3>request:</h3>
- <pre><code>{
- id:String
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- query:String [computed search query],
- publication:
- {
- title: String,
- author_id: String,
- image_id: String,
- text: String,
- description: String,
- id: String,
- createdAt: String,
- tags: [String],
- difficult: Number
- }
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Update</strong></h1>
- </li>
- </ul>
- <p><code>put(/api/v1/publications)</code></p>
- <h3>request:</h3>
- <pre><code> {
- target:String,
- title:String,
- description:String,
- text:String,
- difficult:Number,
- add_tags:[String] [list of new tags],
- remvoe_tags:[String] [list of tags to remove]
- image_id:String
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>eq. Publication.delete
- </code></pre>
- <ul>
- <li>
- <h1><strong>Create</strong></h1>
- </li>
- </ul>
- <p><code>post(/api/v1/publications)</code></p>
- <h3>request:</h3>
- <pre><code> {
- title:String,
- description:String,
- text:String,
- difficult:Number,
- tags:[String],
- image_id:String
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- publication:
- {
- title: String,
- author_id: String,
- image_id: String,
- text: String,
- description: String,
- id: String,
- createdAt: String,
- tags: [String],
- difficult: Number
- }
- }
- </code></pre>
- <h2>2. Users</h2>
- <ul>
- <li>
- <h1><strong>Search</strong></h1>
- </li>
- </ul>
- <p><code>get(/api/v1/users)</code></p>
- <p>request (use URL-encoded request):</p>
- <pre><code>page:Number(>0) (optinal)
- limit:Number(>0) (optinal)
- fullname:String (optinal)
- email:String (optinal)
- publications:["String"] (optinal)
- id:String (optinal)
- isAdmin:Boolean (optinal)
- telegram:String (optinal)
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- query:String [computed search query],
- page: Number,
- total: Number,
- limit: Number,
- pager: Number,
- items:
- [
- {
- fullname: String,
- telegram: String,
- email: String,
- isAdmun: Boolean,
- publicaitons: [String],
- id: String
- }
- ]
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Delete</strong></h1>
- </li>
- </ul>
- <p><code>delete(/api/v1/users)</code></p>
- <h3>request:</h3>
- <pre><code>{
- id:String
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- query:String [computed search query],
- user:
- {
- fullname: String,
- telegram: String,
- email: String,
- isAdmun: Boolean,
- publicaitons: [String],
- id: String
- }
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Update</strong></h1>
- </li>
- </ul>
- <p><code>put(/api/v1/users)</code></p>
- <h3>request:</h3>
- <pre><code> {
- target:String,
- fullname:String (optinal)
- email:String (optinal
- password:String (optional)
- id:String (optinal)
- isAdmin:Boolean (optinal)
- telegram:String (optinal)
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>eq. Users.delete
- </code></pre>
- <h2>3. Resources</h2>
- <ul>
- <li>
- <h1><strong>Get</strong></h1>
- </li>
- </ul>
- <p><code>get(/api/v1/res)</code></p>
- <p>request (use URL-encoded request):</p>
- <pre><code>id:String
- </code></pre>
- <p>response:</p>
- <pre><code>file-data
- </code></pre>
- <ul>
- <li>
- <h1><strong>Delete</strong></h1>
- </li>
- </ul>
- <p><code>delete(/api/v1/res)</code></p>
- <h3>request:</h3>
- <pre><code> {
- id:String
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code> {
- success:true,
- id: String
- }
- </code></pre>
- <ul>
- <li>
- <h1><strong>Create</strong></h1>
- </li>
- </ul>
- <p><code>post(/api/v1/res)</code></p>
- <h3>request:</h3>
- <pre><code>[use form-data header]
- {
- file:File
- }
- </code></pre>
- <h3>response:</h3>
- <pre><code>{
- success:true,
- id:String
- }
- </code></pre>
- </div>
- </div>
- </div>
- <footer>
- <div class="light">
- <p>Developer: <em>Danil Kazimirov</em>, KPI student, <b>FAM</b><br>
- Contact me by <a href="https://telegram.me/ZulusK"
- target="_blank">telegram</a>
- </p>
- </div>
- </footer>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement