API Issue "model is null"

Hello,

I’m trying to find a way to let a robot to create a schedule for a process.

Goal: Process A should check in an excel file all the processes that needs to be executed in that day. Later, it should schedule a run of the robot B on Orchestrator at the time indicated in the Excel file.

To address the goal we were looking to the Orchestrator API, but I’m getting a bit stuck here.

For demo purposes, I’m trying to create a schedule of a process. To do this, I’m using Orchestrator HTTP Request and doing a POST request to the relative endpoint “/odata/ProcessSchedules” with this JSON: “{” + Environment.NewLine + “”“Enabled”": true," + Environment.NewLine + “”“Name”": ““ApiTest””," + Environment.NewLine + “”“ReleaseId”": 91," + Environment.NewLine + “”“ReleaseName”": ““WorkDemo””," + Environment.NewLine + “”“StartProcessCron”": ““0 30 10 10 12 6 2021"”,” + Environment.NewLine + “”“StartStrategy”": ““Specific””," + Environment.NewLine + “”“ExecutorRobots”": [{"“Id”": 18}]," + Environment.NewLine + “”“StopProcessExpression”": “”""," + Environment.NewLine + “”“StopStrategy”": null," + Environment.NewLine + “”“TimeZoneId”": ““GMT Standard Time””" + Environment.NewLine + “}”
. Unfortunately I cannot indent it since UIPath didn’t recognize it properly for some reason.

After we gave to the robot the right to add, edit and delete schedules, still we’re getting an unknown error from the API that is "{“message”:“model is null!”,“errorCode”:0,“resourceIds”:null}.

Why is this happening?

Thanks,
Matteo

PS: Orchestrator version 2018.2.6. I can’t update the version because I’m not authorized to so, and the admin is working on it but for now they want to keep this version. I can’t do anything about it.

@matteote

Can you pass the JSON body in correct format and check?

Check below thread for your reference

Hope this may help you

Thanks

Thanks

Hello @Srini84,

Sorry for the delay but I was on holiday. Hope you’re doing well.

I’m not really able to do that. If I copy the JSON with the correct format, that is:
“{
““Enabled””: true,
““Name””: ““ApiTest””,
““ReleaseId””: 91,
““ReleaseName””: ““WorkDemo””,
““StartProcessCron””: ““0 30 10 10 12 6 2021"”,
““StartStrategy””: null,
““ExecutorRobots””:
[{”“Id””: 18}],
““StopProcessExpression””: “”"",
““StopStrategy””: null,
““TimeZoneId””: ““GMT Standard Time””
}"

I get this: String constants must end with a double quote.

Not sure what I should understand from the topic you’ve linked. I should use that JSON as a base to start and change details with mine ans try again? Or it’s something I’m missing?

Thanks again for your help.
Matteo

@matteote

If you are passing that in the actual JSON structure then you will get similar error, Try making in one line and try

Hope this will help you

Thanks

Again, sorry but I’m not understanding what you’re saying.

You asked me to pass the JSON in the “correct format” and now you’re telling me that I will get an error. Not sure so what I should do. Previously I’ve done it in just one line and I’ve got “model is null”, that’s the reason I’ve opened this discussion. Can you elaborate your message so I can understand better your point?

Thanks,
Matteo

@matteote

Sorry my bad, I confused you alot, While you are making this into the single line you have used Environment.NewLine, that was not required

Also you can refer below video for making into single line

Reference

Hope this will help you

Thanks

Hello @Srini84,

Okay, I’ve seen the video and now the JSON looks like this:

"{Enabled: true,Name: 'ApiTest',ReleaseId: 91,ReleaseName: 'WorkDemo',StartProcessCron: '0 30 10 10 12 6 2021',StartStrategy: null,ExecutorRobots:[{Id: 18}],StopProcessExpression: '',StopStrategy: null,TimeZoneId: 'GMT Standard Time'}"

But still, I get “model is null” as an error. Please tell me if the JSON contains the right data, needs to be formatted, or if it needs more/less data.

Note: When I say “data” I don’t mean the informations added (that’s obviously something you can’t know) but if, for example, I have to enter other data or reformat something.