# Briyal API Document
# Login
- [x] Done
**Request**: /api/login
**Method**: POST
**Body**:
~~~ json
{
"phone": "380508703698",
"password": "11111111"
}
~~~
**Response**:
~~~
{
"access_token": "6|vqIkUWE3z9nTMMr0JBx09LWPUKnsqEjAueBg7sR8",
"token_type": "Bearer"
}
~~~
# Register
- [x] Done
**Request**: /api/register
**Method**: POST
**Body**:
~~~ json
{
"email": "ohteomel137@gmail.com",
"address": "address1",
"phone": "380508703698",
"first_name": "firstN",
"last_name": "lastN",
"password": "11111111"
}
~~~
**Response**:
~~~
{
"success": true,
"data": {
"user": {
"customer_id": "FL599",
"first_name": "firstN",
"last_name": "lastN",
"phone": "380508703698",
"email": "ohteomel137@gmail.com",
"confirmed": false,
"updated_at": "2022-08-30T07:59:16.000000Z",
"created_at": "2022-08-30T07:59:16.000000Z",
"id": 2
}
}
}
~~~
## Account confirmation
**Request**: /api/account/confirmation
**Method**: POST
**Body**:
~~~ json
{
"phone": "380508703698",
"confirmation_code": "8299"
}
~~~
**Response**:
~~~
{
"success": true,
"data": {
"access_token": "7|MAega0uxlWYfBgRDtyIl7Bm9o1GJvdSPhADU75gm"
}
}
~~~
## Resend confirmation email
**Request**: /api/account/confirmation/resend
**Method**: POST
**Body**:
~~~ json
{
"phone": "380508703698"
}
~~~
**Response**:
~~~
{
"success": true,
"data": []
}
~~~
# Reset Password
## Sending reset code
- [x] DONE
#### Step 1:
Request: /api/password/forgot
method: POST
Body:
~~~ json
{
"phone": "380508703698"
}
~~~
Response:
~~~ json
{
"success": true,
"data": "380508703698"
}
~~~
#### Step 2:
Request: /api/password/reset
method: POST
Body:
~~~ json
{
"phone": "380508703698",
"code": "7444",
"password": "12345678"
}
~~~
Response:
~~~ json
{
"success": true,
"data": []
}
~~~
# User info
- [x] Done
**Request**: /api/user
**Method**: GET
#### Need authorization
**Response**:
~~~
{
"id": 9,
"customer_id": "NL233",
"first_name": "name2",
"last_name": "last name3",
"email": "ohteomel137@gmail.com",
"phone": "380508703698",
"address": null,
"car_plate": null,
"note": null,
"email_verified_at": null,
"confirmed": 1,
"new_phone": null,
"language": "english",
"avatar": "646ac3d0b85a6.jpg",
"role_id": 3,
"status": 1,
"created_at": "2023-05-17T00:49:43.000000Z",
"updated_at": "2023-05-18T01:28:10.000000Z"
}
~~~
# User avatar
- [X] Done
**Request**: /storage/avatars/{filename}
**Example**: /storage/avatars/646ac3d0b85a6.jpg
# Set/Update user avatar image
- [X] Done
**Request**: /api/user/avatar
**Method**: POST
#### Need authorization
**Body**:
~~~ json
{
"file": filedata
}
~~~
**Response**:
~~~
{
"success": true
}
~~~
# Edit user data
- [X] Done
**Request**: /api/user
**Method**: POST
#### Need authorization
**Body**:
~~~ json
{
"first_name": "name2",
"last_name": "last name3",
"email": "ohteomel137@gmail.com",
"phone": "380508703698",
"language": "english"
}
~~~
**Response**:
~~~
{
"success": true,
'phone_changed' => true,
}
~~~
## Email Change Confirmation
### When "phone_changed" in previous is true
- [X] Done
**Request**: /api/user/modify/confirm
**Method**: POST
#### Need authorization
**Body**:
~~~ json
{
"confirmation_code": "7847"
}
~~~
**Response**:
~~~
{
"success": true,
"data": {
"user": {
"id": 9,
"customer_id": "NL233",
"first_name": "name2",
"last_name": "last name3",
"email": "ohteomel137@gmail.com",
"phone": "380508703698",
"address": null,
"car_plate": null,
"note": null,
"email_verified_at": null,
"confirmed": 1,
"new_phone": null,
"language": "english",
"avatar": "",
"role_id": 3,
"status": 1,
"created_at": "2023-05-17T00:49:43.000000Z",
"updated_at": "2023-05-18T01:28:10.000000Z"
}
}
}
~~~
# Change password
- [x] Done
**Request**: /api/user/password/change
**Method**: POST
#### Need authorization
**Body**:
~~~ json
{
"old_password": "12345678",
"new_password": "123456"
}
~~~
**Response**:
~~~
{
"success": true,
"data": []
}
~~~
# Remove user data
- [x] Done
**Request**: /api/delete-user
**Method**: POST
#### Need authorization
**Body**:
~~~ json
{
"password": "123456"
}
~~~
**Response**:
~~~
{
"success": true
}
~~~
**Error**: Code 401
~~~
{
"message": "Invalid password"
}
~~~
**Error**: Code 422
~~~
{
"message": "The password field is required.",
"errors": {
"password": [
"The password field is required."
]
}
}
~~~
# Material Category list
- [X] Done
**Request**: /api/materials/categories
**Method**: GET
**Response**:
~~~
{
"success": true,
"data": {
"category_list": [
{
"id": 1,
"name": "Plastic"
}
]
}
}
~~~
# Material list
- [X] Done
**Request**: /api/materials
**Method**: GET
**Response**:
~~~
{
"success": true,
"data": {
"min_request_cost": 100,
"material_list": [
{
"id": 5,
"name": "bootle",
"unit": "unit",
"user_price": 12,
"collector_price": 13,
"image_file": "bottle.jfif"
}
]
}
}
~~~
# Material image
- [X] Done
**Request**: /storage/materials/{filename}
**Example**: /storage/materials/bottle.jfif
# Transaction and wallet info
- [x] Done
**Request**: /api/transactions
**Method**: GET
#### Need authorization
**Response**:
~~~
{
"success": true,
"data": {
"wallet_value": 300,
"transaction_list": [
{
"id": 1,
"request_id": null,
"wallet_before": 0,
"value": 500,
"type": "ADJUSTMENT"
},
{
"id": 2,
"request_id": null,
"wallet_before": 500,
"value": -200,
"type": "DEPOSIT"
}
]
}
}
~~~
# Create Pickup Request
- [x] Done
**Request**: /api/request/create
**Method**: POST
#### Need authorization
**Body**:
~~~ json
{
"coordinate": "coord",
"streetAddress": "street",
"districtAddress": "dist",
"note": "123",
"item_list": [
{
"id": 2, //Material id
"count": 6
},
{
"id": 3,
"count": 1
}
]
}
~~~
**Response**:
~~~
{
"success": true
}
~~~
**Error**:
~~~
{
"message": "You should collect at least 100 SAR worth of recyclable materials!",
"errors": {
"item_list": [
"You should collect at least 100 SAR worth of recyclable materials!"
]
}
}
~~~
# Requests list
- [x] Done
**Request**: /api/request
**Method**: GET
#### Need authorization
**Response**:
~~~
{
"success": true,
"data": {
"request_list": [
{
"id": 1,
"user_id": 10,
"collector_id": null,
"total_price": 152,
"status": "NEW",
"address": null,
"coordinate": "coord",
"streetAddress": "street",
"districtAddress": "dist",
"note": "123",
"created_at": "2023-06-05T01:32:01.000000Z",
"updated_at": "2023-06-05T01:32:01.000000Z",
"item_list": [
{
"id": 1,
"material_id": 2,
"count": 6,
"cost": 72,
"approved": 0
},
{
"id": 2,
"material_id": 3,
"count": 1,
"cost": 80,
"approved": 0
}
]
}
]
}
}
~~~