Forum Discussion

ebudihar's avatar
ebudihar
Occasional Contributor
7 years ago
Solved

REST api

dear all, I have a question. I would like to write a groovy script to call REST using REST API. The same groovy script I used for SOAP request, it is working already. When I implement it and change ...
  • JHunt's avatar
    7 years ago

    Property expansions are those times you use the ${ } notation inside some string in SoapUI. It's made to look similar to the groovy syntax for Strings (GStrings), but it's not quite the same thing. Property expansions can more easily find some things, like how you are using it to get a property belonging to a on another test step. This functionality was created inside SoapUI.

     

    As for your request, the data inside the messages object looks correct. But you have changed it from your first version which had an array of objects, similar to (1):

     

    "messages": [ { "abc" = "def" } ]

     

    But what you have now is not valid, similar to (2):

     

    "messages": [ "abc": "def "]

     

    Either go back to the first type (an array of objects) or you can just use a single object (3):

     

    "messages": { "abc":"def" }

    This will depend on what your API is expecting, either like (1) or like (3).

     

    {   
       "INTEGRATIONID" : "testIntegration",
       "INTERFACENAME" : "testInterface",
       "messages": [{
           "AccountName": "${Property - batch-account-contact#AccountName}",
           "Billing_Street": "${Property - batch-account-contact#Billing_Street}",
           "AccountNo": "${Property - batch-account-contact#AccountNo}",
           "Billing_City": "${Property - batch-account-contact#Billing_City}",
           "Billing_Country": "${Property - batch-account-contact#Billing_Country}"                                                                                      
       }]
    }