This API allows you to send a request to the AI system and receive a response. The endpoint supports a GET method to submit a user input as a URL path parameter.
The request should be made using a GET request with the following URL structure:
/api/{user-id}/{user-input}
The response will be in JSON format with the following structure:
{
"user_input": "The user input",
"user_id": "User ID",
"response": "The response from the AI system"
}
URL:
/api/IAMKKD/How to reverse a string in Python?
Response:
{
"user_input": "How to reverse a string in Python?",
"user_id": "IAMKKD",
"response": "def reverse(s):\\n return s[::-1]"
}
URL:
/api/IAMKKD/Write a Python program to find the factorial of a number
Response:
{
"user_input": "Write a Python program to find the factorial of a number",
"user_id": "IAMKKD",
"response": "def factorial(n):\\n if n == 0:\\n return 1\\n else:\\n return n * factorial(n-1)\\n\\nnum"
}