Skip to content
Yuan Wang edited this page Mar 26, 2020 · 11 revisions

Welcome to the CMPUT404-project-socialdistribution wiki!

Default Headers in HTTP requests

"Authorization" : "Basic {dXNlcjJAZW1ha--ATOKEN--WwuY29tOnBhc3Nxd2Vy}"  // if (Authorization) specified.
"Content-type" : "application/json"

We are using DRF Basic Authentication for authorization required API endpoints, so please include "Authorization" header when needed.

Example: if you have an account: Email: [email protected] Password: passqwer, the authorization header would be like:

Authorization: Basic dXNlcjFAZW1haWwuY29tOnBhc3Nxd2Vy

dXNlcjFAZW1haWwuY29tOnBhc3Nxd2Vy is base64 encoding of "[email protected]:passqwer"

In python3, you can convert utf-8 string to base64 encoding by:

>>> import base64
>>> base64.b64encode(bytes('[email protected]:passqwer', 'utf-8'))
b'dXNlcjFAZW1haWwuY29tOnBhc3Nxd2Vy'

API Links:

Backend User API

Backend Post API

Backend Comment API

Backend Friend API