Skip to content

on-victorrijks/Shaready

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shaready

Shaready is a social information network aiming to conquer the magnificent market of communication and knowledge.

The future of Shaready

API docs

The api is divided into 4 distinct parts, there are :

Authentication of api's

- For some endpoints, the api requires a per-session verification to interact with the shaready database.
- For the api to accept your post request, you have to take the "csrf-token" using the getCookie function, here is an example: https://docs.djangoproject.com/fr/3.1/ref/csrf/
const insertPost = async function(data, url_request) {
let response = await fetch(url_request, {
  method: 'POST',
  headers : {
    'Content-Type': 'application/json',
    'X-CSRFToken' : getCookie('csrftoken'),
    'credentials' : 'same-origin',
  },
  body: JSON.stringify(data)
})
To request the endpoints that have permissions you must add in the header of your requests the cookies with "credentials".
fetch('https://example.com:1234/users', {
credentials: 'include'
})

fetch('/users', {
credentials: 'same-origin'
})

Api articles

This part of the api manages all the interactions that the system needs to read or create articles, all the endpoints available in this part of the api are below :
To get all the categories of the application
Get : /api/articles/categories
To get all the articles in a category
Get : /api/articles/getarticlecategory/<idCategory>/<idPage>
To get all the articles of a user
Get : /api/articles/getarticleuser/<idUser>/<idPage>
To take all the items of your subscriptions, you must authenticate yourself to access this endpoint.
Get : /api/articles/getarticlessubscribed/<int:idPage>
To get all the articles of the trends
Get : /api/articles/gettrends/
To create an article, you must authenticate yourself to access this endpoint.
Post : /api/articles/postcreatearticle

const data = {
      "title" : <your tilte>,
      "content_article" : <your content>,
      "id_category" : <id's category>
    }
To create a like on an article, you must authenticate yourself to access this endpoint.
Post : /api/articles/getarticleuser/<idUser>

const data = {
    "reaction" : 1 = Goldlike, 2 = Like, 3 = Dislike
  }

Api comments

This part of the api manages all the interactions that the system needs to read or create comments, all the endpoints available in this part of the api are below :
To get all the comments of an article
Get : /api/comments/getall/<idArticle>/<idPage>
To create a comment on an article, you must authenticate yourself to access this endpoint.
Post : /api/comments/createcomment/<idArticle>/<pseudoUser>

const data = { "content_comment" : content_comment }
To create a like on a comment, you must authenticate yourself to access this endpoint.
Post : /api/comments/createlike/<idComment>/<pseudoUser>

const data = { "content_comment" : content_comment }

Api notification

This part of the api manages all the interactions that the system needs to read notifications, all the endpoints available in this part of the api are below :
To get the number of unread notifications, you must authenticate yourself to access this endpoint.
Get : /api/notification/getnbsnotifications
To get all your notifications, you must authenticate yourself to access this endpoint.
Get : /api/notification/getallnotification/<idPage>
To change the status of your notifications from unread to read, you must authenticate yourself to access this endpoint.
Post : /api/notification/postmanagenotification

const data = {}

Api user

This part of the api manages all the interactions that the system needs to manage user system, all the endpoints available in this part of the api are below :
To find users
Get : /api/user/getresearchuser/<userResearch>
To get all the information of a user
Get : /api/user/getallinfouser/<idUser>
To search the list of your subscriptions, you must authenticate yourself to access this endpoint.
Get : /api/user/alreadysubscribe/<idReceiving>
To subscribe to a user, you must authenticate yourself to access this endpoint.
Post : /api/user/postsubscription/<pseudoUser>

const data = {
        "id_receiving" : <id_user>
    }

About

Shaready is a social information network aiming to conquer the magnificent market of communication and knowledge.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 53.6%
  • JavaScript 19.3%
  • HTML 16.4%
  • CSS 10.7%