Test Data Manager

Expand all | Collapse all

Javelin Rest Api Call - Query

  • 1.  Javelin Rest Api Call - Query

    Posted 23 days ago
    Edited by Kran 22 days ago
    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 20 days ago
    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 15 days ago
    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 14 days ago
    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 9 days ago
    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 7 days ago
    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 6 days ago
    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