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.

Hi @matteote
I’m getting almost the same message: “{“message”:“model must not be null”,“errorCode”:0,“resourceIds”:null}”
It’s weird because I can’t create Triggers of type Queue but I can create Triggers o type Time.

Have you been able to work it out?

I was having the same error (while in swagger the POST was working fine)

API Exception : Could not create the trigger in Orchestrator. API Response:
{“message”:“model must not be null”,“errorCode”:0,“resourceIds”:null}

Seems that your fields formatting must match exactly what is expected by Orchestrator.

After hours of sniffing and trying different headers, I found my error in the payload at the last field, where in code the date was being formatted as yyyy-MM-dd-ThHH-mm-ss.

I guess you are missing a format in a field as well.

{
“Name”: “OneT-IF0001”,
“InputArguments”: “{}”,
“Enabled”: true,
“UseCalendar”: false,
“StartProcessCronDetails”: “{"type":5,"minutely":{},"hourly":{},"daily":{},"weekly":{"weekdays":},"monthly":{"weekdays":},"advancedCronExpression":"5 44 17 1 May ? 2023"}”,
“StartProcessCron”: “5 44 17 1 May ? 2023”,
“ReleaseId”: 618,
“ReleaseName”: “IF0001”,
“TimeZoneId”: “Eastern Standard Time”,
“StartStrategy”: 1,
“StopProcessExpression”: “12600”,
“StopStrategy”: “SoftStop”,
“StopProcessDate”: “2023-05-01T820:44:05Z”
}

Hi, sorry guys for the silence.

I’ve solved my issue months ago. It was quite simple thanks to UiPath Technical Support. First, make sure UiPath Orchestrator is updated, and then, if the problem is still there, try this: (I’m referring to scheduling a trigger, but I think this approach could be good also for other actions)

  • Go on Orchestrator via UI and do like you really want to schedule a trigger in this way: Fill all the fields requested with the correct data but DO NOT press Save. Before pressing it, if you’re using Chrome, start Network Inspector. All browsers should have the same feature integrated. From there you should be able to see requests done by your computer to the server and check the answer from the server.
  • Now press “Save” and see the API request that your computer sent to the server. Well’, that’s the exact API request you should send.

This should fix the problem you’re facing, or at least is what helped me to do that. Please note that, according to UiPath Support, this error is really really so much general, so there is no “model” you have to search for. It’s just a generic exception that system give in case of an error that is not handled by UiPath so there is not so much to do.

Hope this message will be useful for your research.

Thanks,
Matteo Spirandelli

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.