well, micro, service
Find a file
2024-08-21 16:30:46 +03:30
proxy FIX: views formating 2024-08-19 11:14:42 +03:30
WellService FIX: CRUD with rest but dirty 2024-08-18 17:34:11 +03:30
.gitignore Init 2024-08-05 15:57:56 +03:30
manage.py Core: Send Json over API 2024-08-05 15:59:09 +03:30
ReadMe.md Update ReadMe.md 2024-08-21 16:30:46 +03:30

Well Service End Points

1. Get token

URL: .../token/ Method: POST Input:

  1. Request body:
{
"username": "<username>",
"password": "<password>"
}

1. create

URL: .../wells/create/ Method: POST Input:

  1. Request body:
{
"license_code": "<some_data>",
"representor": "<user_id>",
"subscriptionـcode": "<some_data>",
}
  1. Header:
{"Authorization" : f"Bearer {access_token}" }

Output:

  1. OK:
({"data": "<serializer.data>"},
status=status.HTTP_200_OK)
  1. 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:

  1. URL: well id
  2. Header:
{"Authorization" : f"Bearer {access_token}" }

Output:

  1. OK:
({"data": "<serializer.data>"},
status=status.HTTP_200_OK)
  1. 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:

  1. Header:
{"Authorization" : f"Bearer {access_token}" }

Output:

  1. OK:
({"data": "<serializer.data>"},
status=status.HTTP_200_OK)
  1. Errors:
1 ({"message": "<_Internal Server Error>",
status=status.HTTP_500_INTERNAL_SERVER_ERROR)

4. Delete

URL: ...wells/<well_id>/delete/

Method: DELETE

Input:

  1. URL: well id
  2. Header:
{"Authorization" : f"Bearer {access_token}" }

Output:

  1. OK:
({"data": "<serializer.data>",
"message": f"Successfully removed {instance.license_code}"},
status=status.HTTP_200_OK)
  1. 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:

  1. URL: well id
  2. Header:
{"Authorization" : f"Bearer {access_token}" }
  1. 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)
  1. 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:

  1. URL: well id
  2. Header:
{"Authorization" : f"Bearer {access_token}" }
  1. Request body:
{
"license_code": "<some_data>",
"representor": "<user_id>",
"subscriptionـcode": "<some_data>",
}

Output:

  1. OK:
({"data": "<serializer.data>",
"message": f"<Successfully edited {instance.license_code}>"},
status=status.HTTP_200_OK)
  1. 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)