Skip to content
Snippets Groups Projects
Commit 04899639 authored by Andreas Burbach's avatar Andreas Burbach
Browse files

update

parent 84bcc816
No related branches found
No related tags found
1 merge request!3Feeding chicken with chicken
Pipeline #75551 passed
...@@ -33,8 +33,11 @@ Add *'the_social_network'* to **INSTALLED_APPS** and save the file. ...@@ -33,8 +33,11 @@ Add *'the_social_network'* to **INSTALLED_APPS** and save the file.
Next open the urls.py and add the following line to your **urlpatterns** Next open the urls.py and add the following line to your **urlpatterns**
> url(r'^authentication/', include('the_social_network.urls.authenticationUrls')), > url(r'^authentication/', include('the_social_network.urls.authenticationUrls')),
>
> url(r'^accounts/', include('the_social_network.urls.accountUrls')), > url(r'^accounts/', include('the_social_network.urls.accountUrls')),
>
> url(r'^search/', include('the_social_network.urls.searchUrls')), > url(r'^search/', include('the_social_network.urls.searchUrls')),
>
> url(r'^contents/', include('the_social_network.urls.contentUrls')) > url(r'^contents/', include('the_social_network.urls.contentUrls'))
Now everything is ready to run django with **the-social-network**. Now everything is ready to run django with **the-social-network**.
...@@ -54,12 +57,14 @@ For authorization use the header name "Authorization" and the value "Token <toke ...@@ -54,12 +57,14 @@ For authorization use the header name "Authorization" and the value "Token <toke
#### Authentication #### Authentication
##### POST url: ".../authentication/register/" ##### POST url: ".../authentication/register/"
Register a user Register a user
Requestbody: Requestbody:
{ {
"username": "username", "username": "username",
"password": "password", "password": "password",
"email": " "email": "
} }
Responsebody: Responsebody:
{ {
"token": "token" "token": "token"
...@@ -67,11 +72,13 @@ Responsebody: ...@@ -67,11 +72,13 @@ Responsebody:
##### POST url: ".../authentication/login/" ##### POST url: ".../authentication/login/"
Login a user Login a user
Requestbody: Requestbody:
{ {
"username": "username", "username": "username",
"password": "password" "password": "password"
} }
Responsebody: Responsebody:
{ {
"token": "token" "token": "token"
...@@ -79,20 +86,28 @@ Responsebody: ...@@ -79,20 +86,28 @@ Responsebody:
##### POST url: ".../authentication/logout/" ##### POST url: ".../authentication/logout/"
Logout a user Logout a user
Requestbody: None Requestbody: None
Responsebody: None Responsebody: None
Success: HTTP/200 Success: HTTP/200
##### GET url: ".../authentication/validate/" ##### GET url: ".../authentication/validate/"
Validate a token Validate a token
Requestbody: None Requestbody: None
Responsebody: None Responsebody: None
Success: HTTP/200 Success: HTTP/200
#### Account #### Account
##### GET url: ".../accounts/show/<user_id>/" ##### GET url: ".../accounts/show/<user_id>/"
Show a public user Show a public user
Requestbody: None Requestbody: None
Responsebody: Responsebody:
[{ [{
"user": { "user": {
...@@ -111,7 +126,9 @@ Responsebody: ...@@ -111,7 +126,9 @@ Responsebody:
##### GET url: ".../accounts/show/own/" ##### GET url: ".../accounts/show/own/"
Show the own user Show the own user
Requestbody: None Requestbody: None
Responsebody: Responsebody:
[{ [{
"user": { "user": {
...@@ -129,7 +146,9 @@ Responsebody: ...@@ -129,7 +146,9 @@ Responsebody:
##### GET url: ".../accounts/show/all/" ##### GET url: ".../accounts/show/all/"
Show all public users Show all public users
Requestbody: None Requestbody: None
Responsebody: Responsebody:
[{ [{
"user": { "user": {
...@@ -149,33 +168,44 @@ Responsebody: ...@@ -149,33 +168,44 @@ Responsebody:
##### PUT url: ".../accounts/update/" ##### PUT url: ".../accounts/update/"
Updates the own account. Only "Biography" and "Image" are allowed to be updated. Updates the own account. Only "Biography" and "Image" are allowed to be updated.
Requestbody: Requestbody:
{ {
"biography": "...", "biography": "...",
"file": "..." "file": "..."
} }
Responsebody: None Responsebody: None
Success: HTTP/200 Success: HTTP/200
##### PUT url: ".../accounts/follow/<user_id>/" ##### PUT url: ".../accounts/follow/<user_id>/"
Follow a user Follow a user
Requestbody: None Requestbody: None
Responsebody: None Responsebody: None
Success: HTTP/200 Success: HTTP/200
##### PUT url: ".../accounts/unfollow/<user_id>/" ##### PUT url: ".../accounts/unfollow/<user_id>/"
Unfollow a user Unfollow a user
Requestbody: None Requestbody: None
Responsebody: None Responsebody: None
Success: HTTP/200 Success: HTTP/200
##### PUT url: ".../accounts/operation/add/statement/" ##### PUT url: ".../accounts/operation/add/statement/"
Add a statement to the own account Add a statement to the own account
Requestbody: Requestbody:
{ {
"input": "<statement>" "input": "<statement>"
"reactions": { "to": <reaction_to_a_statement_id>, "relation": <"attack" or "support">} <--- optional "reactions": { "to": <reaction_to_a_statement_id>, "relation": <"attack" or "support">} <--- optional
} }
Responsebody: Responsebody:
{ {
"id": ..., "id": ...,
...@@ -192,12 +222,15 @@ Responsebody: ...@@ -192,12 +222,15 @@ Responsebody:
"created": "...", "created": "...",
"relation_to_parent": ... "relation_to_parent": ...
} }
Success: HTTP/200 Success: HTTP/200
#### Contents #### Contents
##### GET url: ".../contents/statements/get/<statement_id>/" ##### GET url: ".../contents/statements/get/<statement_id>/"
Get a statement Get a statement
Requestbody: None Requestbody: None
Responsebody: Responsebody:
[ [
{ {
...@@ -220,8 +253,11 @@ Responsebody: ...@@ -220,8 +253,11 @@ Responsebody:
##### GET url: ".../contents/statements/with/hashtag/" ##### GET url: ".../contents/statements/with/hashtag/"
Get all statements with a hashtag Get all statements with a hashtag
Requestbody: None Requestbody: None
Queryparameters: "?q=<hashtag>" Queryparameters: "?q=<hashtag>"
Responsebody: Responsebody:
[ [
{ {
...@@ -245,7 +281,9 @@ Responsebody: ...@@ -245,7 +281,9 @@ Responsebody:
##### GET url: ".../contents/statements/feed/" ##### GET url: ".../contents/statements/feed/"
Get all statements of the accounts that are followed by the user Get all statements of the accounts that are followed by the user
Requestbody: None Requestbody: None
Responsebody: Responsebody:
[ [
{ {
...@@ -269,15 +307,20 @@ Responsebody: ...@@ -269,15 +307,20 @@ Responsebody:
##### GET url: ".../contents/trending/hashtag/" ##### GET url: ".../contents/trending/hashtag/"
Get all trending hashtags which are most used in statements Get all trending hashtags which are most used in statements
Requestbody: None Requestbody: None
Reponsebody: ++++++ TODO: Setting of a hashtag not clear ++++++ Reponsebody: ++++++ TODO: Setting of a hashtag not clear ++++++
#### Search #### Search
##### GET url: ".../search/" ##### GET url: ".../search/"
Searchs for a user or hashtag Searchs for a user or hashtag
Requestbody: None Requestbody: None
Queryparameters: "?q=<search_query>&filter=<"user" or "hashtag">" Queryparameters: "?q=<search_query>&filter=<"user" or "hashtag">"
Responsebody: Responsebody:
{ {
"accounts": [ "accounts": [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment