JSON Payload | get process name

Hi All,

I have a requirement to send JSON payload to a HTTP service, in that I have to pass the Process name and the current datetime.

{
	"FaultSummary": {
		"interfaceName": "<UI path process name>",
		"errorTimestamp": "<Current datetime>",
	}
}

How can I make the json body with the uipath process name and current datetime before sending it as body.

Thanks
Yatan

Hi @yatanveersingh ,

Try to send a string, I mean set it as below for POST or PUT request
“{”“FaultSummary”“: {”“interfaceName”“: “””“,”“errorTimestamp”“: ”“}}” …Unless there another atribute remove commo (,) at last…Send as Json

Hi Sukesh,

Can you suggest, how can I dynamically get the process name, current timestamp and the error which occurred in a JSON payload which I can finally send it to a rest service as body

{
	"FaultSummary": {
		"interfaceName": "<UI path process name>",
		"errorTimestamp": "<Current datetime>",
            "error": "<Error which occurred in the process>"
	}
} 

Thanks
Yatan

Hi,

For Process name use “Process.GetCurrentProcess.MainWindowTitle” and for Date use Datetime.Now.ToString

@yatanveersingh ,

As @Jorge_Cavalcante suggested, use “Process.GetCurrentProcess.MainWindowTitle” and for Date use Datetime.Now.ToString along with your error message.

Add it to Dictionary. (using dictionay activities), convert to json using
JsonConvert.SerializeObject( myDictionary ).

Attach to the HTTP load. Let me know if you face any challenges

Hello Yatanveer,
Try to create a JSON like in this movie:

9:45​ Create a simple JSON
11:05​ Create a JSON with an Object inside
12:17​ Create a JSON with Array inside
14:05​ Create a JSON with a List of Strings inside

Thanks,
Cristian Negulescu