POST /signup
Create a new user. Requires an API key in the header.
Request
{
"first_name": "string",
"last_name": "string",
"governarate": "integer",
"secondary_level": "integer",
"email": "string",
"phone": "string",
"parent_phone": "string",
"password": "string"
}
Response
200 OK: User signed up successfully
Example Code
JavaScript
fetch("http://141.136.36.226:8000/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",
"API-Key": "HIDDEN-API-KEY"
},
body: JSON.stringify({
first_name: "John",
last_name: "Doe",
governarate: 1,
secondary_level: 2,
email: "john.doe@example.com",
phone: "1234567890",
parent_phone: "0987654321",
password: "securepassword"
})
})
.then(response => response.text())
.then(data => console.log(data));
Python
import requests
url = "http://141.136.36.226:8000/signup"
headers = {
"Content-Type": "application/json",
"API-Key": "HIDDEN-API-KEY"
}
data = {
"first_name": "John",
"last_name": "Doe",
"governarate": 1,
"secondary_level": 2,
"email": "john.doe@example.com",
"phone": "1234567890",
"parent_phone": "0987654321",
"password": "securepassword"
}
response = requests.post(url, headers=headers, json=data)
print(response.text)
POST /login
Authenticate a user.
Request
{
"email_or_phone": "string",
"password": "string"
}
Response
200 OK: Welcome, {first_name}!
Example Code
JavaScript
fetch("http://141.136.36.226:8000/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email_or_phone: "john.doe@example.com",
password: "securepassword"
})
})
.then(response => response.text())
.then(data => console.log(data));
Python
import requests
url = "http://141.136.36.226:8000/login"
data = {
"email_or_phone": "john.doe@example.com",
"password": "securepassword"
}
response = requests.post(url, json=data)
print(response.text)
POST /change-password
Change a user's password.
Request
{
"email": "string",
"old_password": "string",
"new_password": "string"
}
Response
200 OK: Password changed successfully
Example Code
JavaScript
fetch("http://141.136.36.226:8000/change-password", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: "john.doe@example.com",
old_password: "oldpassword",
new_password: "newpassword"
})
})
.then(response => response.text())
.then(data => console.log(data));
Python
import requests
url = "http://141.136.36.226:8000/change-password"
data = {
"email": "john.doe@example.com",
"old_password": "oldpassword",
"new_password": "newpassword"
}
response = requests.post(url, json=data)
print(response.text)
POST /change-username
Change a user's first and last name.
Request
{
"email": "string",
"first_name": "string",
"last_name": "string"
}
Response
200 OK: Username changed successfully
Example Code
JavaScript
fetch("http://141.136.36.226:8000/change-username", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: "john.doe@example.com",
first_name: "Jane",
last_name: "Doe"
})
})
.then(response => response.text())
.then(data => console.log(data));
Python
import requests
url = "http://141.136.36.226:8000/change-username"
data = {
"email": "john.doe@example.com",
"first_name": "Jane",
"last_name": "Doe"
}
response = requests.post(url, json=data)
print(response.text)
GET /get-user
Retrieve user data by email, phone, or ID.
Request
GET /get-user?identifier=string
Response
200 OK: User Info: {...}
Example Code
JavaScript
fetch("http://141.136.36.226:8000/get-user?identifier=john.doe@example.com")
.then(response => response.json())
.then(data => console.log(data));
Python
import requests
url = "http://141.136.36.226:8000/get-user?identifier=john.doe@example.com"
response = requests.get(url)
print(response.json())