-
Notifications
You must be signed in to change notification settings - Fork 2
Endpoints
- User Registration
- User Authentication
- Change user password
- Get another user's profile
- Posting a claim
- List of claims
- Get a claim
- Filter user's claims
- Modify a claim
- Delete a claim
- Post an evidence
- Get list of evidences of a claim
- Get an evidence
- Modify an evidence
- Delete an evidence
POST /api/v1/users/register/
Example request:
POST /api/v1/users/register/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
{
"username": "enis",
"email": "[email protected]",
"password": "123456"
}
Example response:
HTTP/1.1 201 CREATED
Content-Type: application/json; charset=utf-8
{
"id": "2",
"username": "enis",
"email": "[email protected]",
"token": "example_token"
}
POST /api/v1/users/login/
Example request:
POST /api/v1/users/login/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
{
email: "[email protected]",
password: "123456"
}
Example response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"id": "2",
"username": "enis",
"email": "[email protected]",
"token": "example_token"
}
GET /api/v1/users/:username/
Example request:
GET /api/v1/users/enis/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
Example response:
{
"id": 7,
"username": "enis",
"name": "Enis B. Tuysu",
"bio": "bio",
"claim_count": 105,
"avatar": null
}
NOTE:
For claims of the user, you should make request like this http://factlist.org/api/v1/claims/?filter=from:username
For the docs head over to: List of claims
POST /api/v1/users/password/
Example request:
POST /api/v1/users/password/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
Authorization: Token <YOUR-API-TOKEN>
{
current_password: "current_password",
new_password: "new_password"
}
When a user forgets his/her password, we need to go through some steps to change the user's password. These steps are in order:
- User request a password reset email from client with their username or email
- An email with password reset link referring the user to client is being sent to the user. The email is valid for 24 hours
- User returns to the client with a password reset key
- User enters the new password and client will send the key and the new password to the API
- API verifies the code and password then changes the password
Example request:
POST /api/v1/users/forgot_password/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
{
"user_identifier": "enis" // Username or email
}
This endpoint will return 200 no matter what to protect users privacy.
After this, an email will be sent to the user, containing a link like this:
factlist.com/change_password/?key=ABCDE1234567
You will use the key in the URL to change the user's password
Example request:
POST /api/v1/users/change_password/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
{
"key": "ABCDE123456", // The key in the URL
"password": "#factlist"
}
POST /api/v1/claims/
Example request:
POST /api/v1/claims/ HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Authorization: Token <YOUR-API-TOKEN>
{
"links": [{"link": "http://www.bbc.com/news/world-asia-42999499"}],
"text": "Thailand woman killed taking selfie on train tracks",
"files": []
}
Example response:
HTTP/1.1 201 OK
Content-Type: application/json; charset=utf-8
{
'date_created': '2018-02-28T12:42:44.191315Z',
'text': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'id': 9,
'claim_links': [],
'user': {
'id': 1,
'email': '[email protected]',
'username': 'enis'
}
'evidences': []
}
GET /api/v1/claims/
Example request:
GET /api/v1/claims/ HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Example response:
{
"count": 2,
"next": "http://localhost:8000/api/v1/claims/?limit=50&offset=50",
"previous": null,
"results": [
{
"id": 1,
"text": "Uma thurman's car crash footage from Kill Bill",
"user": {
"id": 1,
"email": "[email protected]",
"username": "serafettin"
},
"links": [],
"created_at": "2018-03-04T15:25:53.782821Z",
"updated_at": null,
"deleted_at": null,
"files": [
{
"file": "http://localhost:8000/api/v1/claims/http%3A/pics.imcdb.org/0is269/killbill2karmannghia6.3438.jpg",
"id": 1
}
],
"true_count": 1,
"false_count": 0,
"inconclusive_count": 0
},
{
"id": 2,
"text": "Women need more sleep than men",
"user": {
"id": 1,
"email": "[email protected]",
"username": "serafettin"
},
"links": [],
"created_at": "2018-03-04T15:25:53.842122Z",
"updated_at": null,
"deleted_at": null,
"files": [
{
"file": "http://localhost:8000/api/v1/claims/https%3A/www.helpguide.org/images/sleep/sleeping-woman-500.jpg",
"id": 2
}
],
"true_count": 0,
"false_count": 1,
"inconclusive_count": 0
},
}
GET /api/v1/claims/?filter=from:<username>
Example request:
GET /api/v1/claims/?filter=from:enisbt HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Authorization: Token <YOUR-API-TOKEN>
Example response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 293,
"text": "Test claim",
"user": {
"id": 2,
"email": "[email protected]",
"username": "enis"
},
"links": [],
"created_at": "2018-03-09T10:38:19.469924Z",
"updated_at": null,
"deleted_at": null,
"files": [],
"true_count": 0,
"false_count": 0,
"inconclusive_count": 0
}
]
}
GET /api/v1/claims/:claim_id
Example request:
GET /api/v1/claims/:claim_id HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Example response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
'date_created': '2018-02-28T12:42:44.191315Z',
'text': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'id': 9,
'links': [],
'user': {
'id': 1,
'email': '[email protected]',
'username': 'enis'
}
'evidences': [],
'files': []
}
PATCH /api/v1/claims/:claim_id
Example request:
PATCH /api/v1/claims/:claim_id HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Authorization: Token <YOUR-API-TOKEN>
{
'date_created': '2018-02-28T12:42:44.191315Z',
'text': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'id': 9,
'links': [],
'user': {
'id': 1,
'email': '[email protected]',
'username': 'enis'
}
'evidences': []
}
DELETE /api/v1/claims/:claim_id
Example request:
DELETE /api/v1/claims/:claim_id HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Authorization: Token <YOUR-API-TOKEN>
Example response:
HTTP/1.1 204 NO CONTENT
Content-Type: application/json; charset=utf-8
POST /api/v1/claims/:claim_id/evidences/
Example request:
POST /api/v1/claims/:claim_id/evidences/ HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Authorization: Token <YOUR-API-TOKEN>
{
"links": ["http://www.bbc.com/news/world-asia-42999499"],
"files": []
"text": "Thailand woman killed taking selfie on train tracks",
"conclusion": true,
}
Example response.
HTTP/1.1 201 OK
Content-Type: application/json; charset=utf-8
[
{
"id": 1,
"text": "Lorem",
"conclusion": "true",
"created_at": "2018-03-03T18:05:22Z",
"user": {
"id": 1,
"email": "[email protected]",
"username": "enis"
},
"links": [
{
"link": "https://github.com/serafettin",
"id": 1
}
],
"files": [
{
"file": "http://localhost:8001/media/files/claims/2018/03/03/octosetup-linux_i386.bin",
"id": 1
}
]
}
]
GET /api/v1/claims/:claim_id/evidences/
Example request:
GET /api/v1/claims/:claim_id/evidences/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
Example response:
HTTP 200 OK
Allow: GET, POST, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 3,
"text": "The footage of the unusual cloud formation was originally shot in the Canadian town of Grand Falls, New Brunswick and posted online on 1 August 2011 by Denis Laforge.",
"conclusion": "false",
"created_at": "2017-12-28T00:00:00Z",
"updated_at": null,
"deleted_at": null,
"user": {
"id": 1,
"email": "[email protected]",
"username": "serafettin"
},
"links": [
{
"link": "https://www.youtube.com/watch?v=gdg6WU_aqWE",
"id": 3
}
],
"files": []
}
]
}
GET /api/v1/claims/:claim_id/evidences/:evidence_id/
Example request:
GET /api/v1/claims/:claim_id/evidences/:evidence_id/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
Example response:
HTTP 200 OK
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"id": 3,
"text": "The footage of the unusual cloud formation was originally shot in the Canadian town of Grand Falls, New Brunswick and posted online on 1 August 2011 by Denis Laforge.",
"conclusion": "false",
"created_at": "2017-12-28T00:00:00Z",
"updated_at": null,
"deleted_at": null,
"user": {
"id": 1,
"email": "[email protected]",
"username": "serafettin"
},
"links": [
{
"link": "https://www.youtube.com/watch?v=gdg6WU_aqWE",
"id": 3
}
],
"files": []
}
PATCH /api/v1/claims/:claim_id/evidences/:evidence_id/
Example request:
PATCH /api/v1/claims/:claim_id/evidences/:evidence_id/ HTTP/1.1
Host: https://factlist.org
Content-Type: multipart/form-data
Authorization: Token <YOUR-API-TOKEN>
Example response:
HTTP/1.1 201 OK
Content-Type: application/json; charset=utf-8
{
"id": 1,
"text": "Lorem",
"conclusion": "true",
"created_at": "2018-03-03T18:05:22Z",
"user": {
"id": 1,
"email": "[email protected]",
"username": "enis"
},
"links": [
{
"link": "https://github.com/serafettin",
"id": 1
}
],
"files": [
{
"file": "http://localhost:8001/media/files/claims/2018/03/03/test_files.bin",
"id": 1
}
]
}
DELETE /api/v1/claims/:claim_id/evidences/:evidence_id/
Example request:
DELETE /api/v1/claims/:claim_id/evidences/:evidence_id/ HTTP/1.1
Host: https://factlist.org
Content-Type: application/json
Authorization: Token <YOUR-API-TOKEN>
Example response:
HTTP/1.1 204 NO CONTENT
Content-Type: application/json; charset=utf-8