How to test REST API using Chrome's extension “Advanced Rest Client”

后端 未结 8 1096
我寻月下人不归
我寻月下人不归 2020-12-04 08:28

Following the instructions at the link below, I successfully built a REST API for my Django application: http://django-rest-framework.org/tutorial/quickstart.

I can

相关标签:
8条回答
  • 2020-12-04 08:49

    With latest ARC for GET request with authentication need to add a raw header named Authorization:authtoken.

    Please find the screen shot Get request with authentication and query params

    To add Query param click on drop down arrow on left side of URL box.

    0 讨论(0)
  • 2020-12-04 08:52

    Add authorization header and click pencil button to enter username and passwords

    0 讨论(0)
  • 2020-12-04 08:57

    This seems a very old question, but I am providing an answer, so that it might help others. You can specify the variables in the second screen in the form section, as shown below or in the RAW format by appending the variables as shown in the second image.

    Specify Form Variables

    Specify in RAW format

    If your variable and variable values are valid, you should see a successful response in the response section.

    0 讨论(0)
  • 2020-12-04 08:58

    in the header section you have to write

    Authorization: Basic aG9sY67890vbGNpbQ==

    where string after basic is the 64bit encoding value of your username:password. php example of getting the header values is: echo "Authorization: Basic " . base64_encode("myUser:myPassword");

    n.b: I assumed your authentication method as basic. which can be different as well.

    0 讨论(0)
  • 2020-12-04 08:59

    The easy way to get over of this authentication issue is by stealing authentication token using Fiddler.

    Steps

    1. Fire up fiddler and browser.
    2. Navigate browser to open the web application (web site) and do the required authentication.
    3. Open Fiddler and click on HTTP 200 HTML page request.
    4. On the right pane, from request headers, copy cookie header parameter value.
    5. Open REST Client and click on "Header form" tab and provide the cookie value from the clip board.

    Click on SEND button and it shall fetch results.

    0 讨论(0)
  • 2020-12-04 09:01

    The shortcut format generally used for basic auth is http://username:password@example.com/path. You will also want to include the accept header in the request.

    enter image description here

    0 讨论(0)
提交回复
热议问题