Test Data Manager

 View Only
  • 1.  Javelin Rest Api Call - Query

    Posted Apr 20, 2021 07:00 AM
    Edited by Karan Aggarwal Apr 21, 2021 10:06 AM
    Hi team,
    I need to automate some rest api through Javelin, so for that I need to pass "x-www-form-urlencoded" as Body type for REST POST API call.
    [Screenshot from Postman]

    Can you please suggest some idea on how we can achieve this, any help would be great.

    Thanks & Regards


  • 2.  RE: Javelin Rest Api Call - Query

    Broadcom Employee
    Posted Apr 23, 2021 03:31 PM
    As discussed, try executing with curl from a Javelin "Invoke Process" step.   You can get the curl string from Postman by clicking the "Code" link
    Paste the curl string into a .bat file, then in the Invoke Process activity, specify the full path to the .bat file (surrounded in double-quotes).
    For the working directory property, specify "C:\windows\system32"


  • 3.  RE: Javelin Rest Api Call - Query

    Posted Apr 29, 2021 03:37 AM
    Hi Scott,
    I've implemented the same process as suggested by you using the curl command, but the output file is empty and same curl is executing fine from postman. 
    Below is the screenshot attached of the Invoke process activity and workflow.



    Thanks


  • 4.  RE: Javelin Rest Api Call - Query

    Broadcom Employee
    Posted Apr 29, 2021 10:19 AM
    Javelin would be trying to execute the cURL installed in Windows rather than in Postman - can you try the cURL command interactively from a command line & see if it works.   If not, adjust it until it works then incorporate into Javelin.​


  • 5.  RE: Javelin Rest Api Call - Query

    Broadcom Employee
    Posted May 04, 2021 12:54 PM
    Here's a step-by-step.
    In Postman, setup a GET to https://pokeapi.co/api/v2/pokemon/squirtle/
    Click on the "code" hyperlink and you'll get something like this:
    curl --location --request GET 'https://pokeapi.co/api/v2/pokemon/squirtle/' --header 'Cookie: __cfduid=d4d69ba8707f24011389f0e1d7b7ec8fd1620146242'

    Modify it to allow it to run under Windows:   (change single quotes to double quotes, change GET to -XGET, add --ssl-no-revoke to simplify certificates

    curl -XGET --ssl-no-revoke "https://pokeapi.co/api/v2/pokemon/squirtle/" --header "Cookie: __cfduid=d4d69ba8707f24011389f0e1d7b7ec8fd1620146242"

    Paste into a .bat file.   For our test, we'll just append the following to the line in the .bat file     >> C:\temp\squirtle-out.txt

    In Javelin, create a process, add a block Invoke Process, and specify the bat file in the Executable Name field.    Add the path to the cmd.exe in the Working Directory field.    

    Execute, and look at the .txt file for the results.



  • 6.  RE: Javelin Rest Api Call - Query

    Posted May 07, 2021 06:39 AM
    Hi Scott,

    We tried the steps as mentioned by you but still it is coming as blank. PFB the screenshots.



    Regards,

    ------------------------------
    Project Lead
    Wipro Technologies
    ------------------------------



  • 7.  RE: Javelin Rest Api Call - Query

    Broadcom Employee
    Posted May 07, 2021 12:56 PM
    Can you try writing the results to a file?   From the instructions above:    

    append the following to the line in the .bat file     >> C:\temp\squirtle-out.txt