Shaready is a social information network aiming to conquer the magnificent market of communication and knowledge.
The api is divided into 4 distinct parts, there are :
- - 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/
- To request the endpoints that have permissions you must add in the header of your requests the cookies with "credentials".
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)
})
fetch('https://example.com:1234/users', {
credentials: 'include'
})
fetch('/users', {
credentials: 'same-origin'
})
- 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 take all the items of your subscriptions, you must authenticate yourself to access this endpoint.
- To create an article, you must authenticate yourself to access this endpoint.
- To create a like on an article, you must authenticate yourself to access this endpoint.
Get : /api/articles/categories
Get : /api/articles/getarticlecategory/<idCategory>/<idPage>
Get : /api/articles/getarticleuser/<idUser>/<idPage>
Get : /api/articles/getarticlessubscribed/<int:idPage>
Post : /api/articles/postcreatearticle
const data = {
"title" : <your tilte>,
"content_article" : <your content>,
"id_category" : <id's category>
}
Post : /api/articles/postcreatearticle
const data = {
"title" : <your tilte>,
"content_article" : <your content>,
"id_category" : <id's category>
}
- 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 create a comment on an article, you must authenticate yourself to access this endpoint.
- To create a like on a comment, you must authenticate yourself to access this endpoint.
Post : /api/comments/createcomment/<idArticle>/<pseudoUser>
const data = { "content_comment" : content_comment }
Post : /api/comments/createcomment/<idArticle>/<pseudoUser>
const data = { "content_comment" : content_comment }
- 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.
- To get all your notifications, you must authenticate yourself to access this endpoint.
- To change the status of your notifications from unread to read, you must authenticate yourself to access this endpoint.
- 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 search the list of your subscriptions, you must authenticate yourself to access this endpoint.
- To subscribe to a user, you must authenticate yourself to access this endpoint.