3.5 KiB
3.5 KiB
Well Service End Points
JWT related end-points
1. Get token
URL: .../token/ Method: POST Input:
- Request body:
{
"username": "omma",
"password": "123456"
}
Well related end-points
1. create
URL: .../wells/create/ Method: POST Input:
- Request body:
{
"license_code": "<some_data>",
"representor": "<user_id>",
"subscriptionـcode": "<some_data>",
}
- Header:
{"Authorization" : f"Bearer {access_token}" }
Output:
- OK:
({"data": "<serializer.data>"},
status=status.HTTP_200_OK)
- Errors:
1 ({"message":f'<{data["license_code"]} already exists>'},
status=status.HTTP_409_CONFLICT)
2 ({"message": serializer.errors},
status=status.HTTP_400_BAD_REQUEST)
3 ({"message": "<_Internal Server Error>",
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
2. Get by ID
URL: .../wells/<well_id>/ Method: GET Input:
- URL: well id
- Header:
{"Authorization" : f"Bearer {access_token}" }
Output:
- OK:
({"data": "<serializer.data>"},
status=status.HTTP_200_OK)
- Errors:
1 ({"message": "Not Found"},
status=status.HTTP_404_NOT_FOUND)
2 ({"message": "<_Internal Server Error>",
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
3. Get All
URL: .../wells/ Method: GET Input:
- Header:
{"Authorization" : f"Bearer {access_token}" }
Output:
- OK:
({"data": "<serializer.data>"},
status=status.HTTP_200_OK)
- Errors:
1 ({"message": "<_Internal Server Error>",
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
4. Delete
URL: ...wells/<well_id>/delete/
Method: DELETE
Input:
- URL: well id
- Header:
{"Authorization" : f"Bearer {access_token}" }
Output:
- OK:
({"data": "<serializer.data>",
"message": f"Successfully removed {instance.license_code}"},
status=status.HTTP_200_OK)
- Errors:
1.({"message": "Not Found"},
status=status.HTTP_404_NOT_FOUND)
2 ({"message": "<_Internal Server Error>",
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
5. Update
URL: ...wells/<well_id>/update/
Method: PUT
Input:
- URL: well id
- Header:
{"Authorization" : f"Bearer {access_token}" }
- Request body:
{
"license_code": "<some_data>",
"representor": "<user_id>",
"subscriptionـcode": "<some_data>",
}
Output: 5. OK:
(
{"data": "<serializer.data>",
"message": f"<Successfully updated {instance.license_code}>"},
status=status.HTTP_200_OK)
- Errors:
7. ({"message": "Not Found"},
status=status.HTTP_404_NOT_FOUND)
8. ({"message":serializer.errors},
status=status.HTTP_400_BAD_REQUEST)
2 ({"message": "<_Internal Server Error>",
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
6. Edit
URL: ...wells/<well_id>/edit/
Method: PUT
Input:
- URL: well id
- Header:
{"Authorization" : f"Bearer {access_token}" }
- Request body:
{
"license_code": "<some_data>",
"representor": "<user_id>",
"subscriptionـcode": "<some_data>",
}
Output:
- OK:
({"data": "<serializer.data>",
"message": f"<Successfully edited {instance.license_code}>"},
status=status.HTTP_200_OK)
- Errors:
1. ({"message": "Not Found"},
status=status.HTTP_404_NOT_FOUND)
2. ({"message":serializer.errors},
status=status.HTTP_400_BAD_REQUEST)
2 ({"message": "<_Internal Server Error>",
status=status.HTTP_500_INTERNAL_SERVER_ERROR)