Skip to content

Instantly share code, notes, and snippets.

@Konark-Web
Created November 4, 2021 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Konark-Web/e9961fea2709b0b58a31b6d89358f0c2 to your computer and use it in GitHub Desktop.
Save Konark-Web/e9961fea2709b0b58a31b6d89358f0c2 to your computer and use it in GitHub Desktop.
GET http://127.0.0.1:8000/api/posts
[
{
"id": 6,
"author_id": 2,
"author": "test1",
"title": "My third post by API",
"text": "Yes, it's really work!",
"created_date": "2021-10-23T19:21:41.969850Z",
"date_modified": "23 Oct 2021",
"likes": 0
},
{
"id": 5,
"author_id": 2,
"author": "test1",
"title": "My third post by API",
"text": "Yes, it's really work!",
"created_date": "2021-10-23T19:20:00.189560Z",
"date_modified": "23 Oct 2021",
"likes": 0
},
{
"id": 4,
"author_id": 2,
"author": "test1",
"title": "My second post by API",
"text": "Yes, it's really work!",
"created_date": "2021-10-23T19:00:34.506609Z",
"date_modified": "23 Oct 2021",
"likes": 1
},
{
"id": 3,
"author_id": 2,
"author": "test1",
"title": "My first post by API",
"text": "Yes, it's really work!",
"created_date": "2021-10-23T18:53:04.907865Z",
"date_modified": "23 Oct 2021",
"likes": 1
},
{
"id": 2,
"author_id": 1,
"author": "admin",
"title": "Python 3.11.0a1 is available",
"text": "Schwarzschild black holes are also unique because they have a space-like singularity at their core, which means that the singularity doesn't happen at a specific point in *space* but happens at a specific point in *time* (the future). This means once you are inside the event horizon you cannot point with your finger towards the direction the singularity is located because the singularity happens in your future: no matter where you move, you will \"fall\" into it.\r\n\r\nFor a Schwarzschild black hole (a black hole with no rotation or electromagnetic charge), given a free fall particle starting at the event horizon, the maximum propper time (which happens when it falls without angular velocity) it will experience to fall into the singularity is `π*M` (in natural units), where M is the mass of the black hole. For Sagittarius A* (the black hole at the centre of the milky way) this time is approximately 1 minute.",
"created_date": "2021-10-23T13:14:08Z",
"date_modified": "23 Oct 2021",
"likes": 0
},
{
"id": 1,
"author_id": 1,
"author": "admin",
"title": "My first post",
"text": "Good news. It's really work for me.",
"created_date": "2021-10-22T11:08:23Z",
"date_modified": "22 Oct 2021",
"likes": 1
}
]
GET http://127.0.0.1:8000/api/posts/1
{
"id": 1,
"author_id": 1,
"author": "admin",
"title": "My first post",
"text": "Good news. It's really work for me.",
"created_date": "2021-10-22T11:08:23Z",
"date_modified": "22 Oct 2021",
"likes": 1
}
POST http://127.0.0.1:8000/api/authenticate/
{
"name": "TestFirst1 TestLast1",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6InRlc3QxIiwiZXhwIjoxNjM2MDc1Nzg3LCJlbWFpbCI6InRlc3QxQHRlc3QuY29tIn0.xT_V3I4EAJy5lPBCPh7Xc6ekkH5GwReNB1zp5oc5tlI"
}
POST http://127.0.0.1:8000/api/posts/2/like/
{
"message": "You successfully liked the post"
}
POST http://127.0.0.1:8000/api/posts/2/like/
{
"message": "You successfully unliked the post"
}
POST http://127.0.0.1:8000/api/posts/22/like/
{
"message": "Post with ID 22 not found"
}
POST http://127.0.0.1:8000/api/post-create/
{
"id": 7,
"author_id": 2,
"title": "Hello world!",
"text": "It's default text for post",
"created_date": "2021-11-04T17:17:40.479465Z",
"date_modified": "04 Nov 2021"
}
POST http://127.0.0.1:8000/api/create-user/
{
"id": 5,
"username": "newuser-one",
"email": "newuser@test.com",
"first_name": "New User",
"last_name": "New User",
"date_joined": "2021-11-04T17:19:20.747820Z",
"password": "123456"
}
GET http://127.0.0.1:8000/api/analytics/?date_from=2021-02-02&date_to=2021-11-10
{
"2021-10-23": 1
}
GET http://127.0.0.1:8000/api/analytics/?date_from=2021-02-02
{
"2021-10-23": 1,
"2021-11-04": 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment