Web Service - Post method

Please suggest for the invoke web service in the post method & request body with JSON data.

Hello @harikrushna.bhosale,

I don’t think I quite get what you want to see.
I believe you want to retrieve some data in json format while invoking a web service using a post method.

Please take a look here:
https://robin-language.org/docs/robin-the-rpa-language/standard-modules/web-actions/

Specifically the InvokeWebService action.
By clicking on the title you are going to see a list of all its attributes and the values they can get:

Best regards,
J.


James Papadimitriou
Technical Evangelist

1 Like

@jpap thanks for the update but i need an example to invoke web service with json data in request body using post method.

1 Like

@harikrushna.bhosale check this out:

Web.InvokeWebService Url: 'https://jsonplaceholder.typicode.com/posts' \
Method:Web.Method.Post Accept:'*/*' ContentType:'application/json' \
CustomHeaders:'' RequestBody:'''{
    "title": "Robin",
    "body": "The RPA language",
    "userId": "1"
}'''\
ConnectionTimeout:30 FollowRedirection:True ClearCookies:False FailOnErrorStatus:False EncodeRequestBody:False \
UserAgent:'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6' \
Encoding:'' ResponseHeaders=> ResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
Console.Write Message: WebServiceResponse
3 Likes

@harikrushna.bhosale, here is another example showcasing a json return, using a POST method for web api invocation:

Νotice how I have changed the following attributes to use POST method and expect and return to json format:
image

The script:

set ApiUrl to “http://api.geonames.org/wikipediaSearchJSON?formatted=true&q=bangalore&maxRows=10&username=sk12te&style=full
Web.InvokeWebService Url: ApiUrl
Method:Web.Method.Post
Accept:‘application/json’
ContentType:‘application/json’
CustomHeaders:’’
RequestBody:’’
ConnectionTimeout:30
FollowRedirection:True
ClearCookies:False
FailOnErrorStatus:False
EncodeRequestBody:True
UserAgent:‘Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6’
Encoding:’’
ResponseHeaders=> ResponseHeaders
Response=> WebServiceResponse
StatusCode=> StatusCode
Console.Write Message: WebServiceResponse

Hope it helps! :slight_smile:

Best regards,
J.


James Papadimitriou
Technical Evangelist

3 Likes