Doubt: how to create url

How is the url created for the API’s? Can everyone have different url for the same request to the same data?

ok resolved! i did’nt import requests

Hey @itzsakshi26gupta

All web development frameworks provide helper components required to make APIs with custom URLs (like Django and Flask). APIs can also be made without the help from these frameworks too because an API is just an interface which specifies how software components should interact with your website.
Also, it is possible for different URLs to serve the exact same data.

can you please describe with an example how to form the url :slightly_smiling_face:
thanks

Let’s assume you own a Social Networking Website www.abc.com
Now you want to create an API endpoint which gives the basic info of a person.
Then, you can define an endpoint as www.abc.com/user?id=

You can do this in flask as:

from flask import request

@app.route('/user', methods=['GET'])
def get_user_info():
    pass # Do the processing here

Hope this helps!

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.