Issue calling Start Job API when using InputArguments

Hi all,

I have a command that works perfectly fine when called without input arguments, but adding these causes the startJobParameters must not be null error.

Oddly, If I include InputArguments but without the contents within clasps I get instead an “Argument Values validation failed.” error. THis tells me that the issue is probably around how I’m formatting the clasps, but I have tried several approachs without success!

My working code is:
curl:

curl -X POST "{{on-premURL}}/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs" -H "accept: application/json" -H "Authorization: Bearer {{token}}" -k -H "Content-Type: application/json" -d "{  \"startInfo\": {    \"ReleaseKey\": \"{{key}}", \"Strategy\": \"ModernJobsCount\", \"JobsCount\":1}}
.NET:
"{""startInfo"": {""ReleaseKey"": " & Chr(34) & Key & Chr(34) & ", ""Strategy"": ""ModernJobsCount"", ""JobsCount"": 1}}"

I need to add "InputArguments": "{"textInput": "test"}" but cannot figure out how. Many thanks!

This an example of a working example for /odata/Jobs/UiPath.Server.Configuration.OData.StartJobs

{
    "startInfo": {
        "ReleaseKey": "57809827-d624-4955-8cd4-ff8a2f0668ae",
        "JobsCount": 1,
        "JobPriority": "Low",
        "Strategy": "ModernJobsCount",
        "RuntimeType": "Unattended",
        "InputArguments": "{\"age\":33,\"trueOrFalse\":false,\"stringNew\":\"testing\"}",
        "MachineRobots": [
            {
                "RobotId": 6,
                "MachineId": 5
            }
        ]
    }
}

Conclusion, test this "InputArguments": "{\"textInput\":\"test\"}"

As Marian shows should work for you, but I’ll add on that the first error startJobParameters must not be null is indicating that the payload BODY does not match the expected model of the endpoint that you are calling.

You can review https://orchestrator/swagger/index.html#/Jobs/Jobs_StartJobs to see what all the optional / required parameters are, of which InputArguments is required.

InputArguments string
maxLength: 10000
Input parameters in JSON format to be passed to job execution.

So the included value of InputArguments is itself a String of a JSON Object, so you would be better off to create your JSON object and then Serialize it and attach it to the Request Body’s JSON in order to remove the human error of encapsulating and escaping appropriately

Using this I get the same error:

curl -X POST “{{on-prem url}}” -H “accept: application/json” -H “Authorization: Bearer {{token}}” -k -H “Content-Type: application/json” -d “{ "startInfo": { "ReleaseKey": "{{key}}", "Strategy": "ModernJobsCount", "JobsCount":1, "InputArguments": “{"textInput":"test"}”}}”

{“message”:“startJobParameters must not be null”,“errorCode”:0,“resourceIds”:null}

I understand it’s an issue with the body, I just can’t see quite how to solve it!
A .NET solution would be helpful too, as ultimately this is how it will be implemented. curl however is useful to test with!

Thanks

It seems that you didn’t read and re-adapted your code as I mentioned.

Example:

I did, but looks like the forum ripped out my backslashes.

I’ll add that I need backslashes within the first clasp, unlike yours. And again, my main desire is for a working .NET body here.

Use Postman tool to test the API and then use the Code snippet feature:

I’ve put this based on postman:
curl -X POST “{{url}}/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs” -H “accept: application/json” -H “Authorization: Bearer {{token}}” -k -H “Content-Type: application/json” -d “{ "startInfo": { "ReleaseKey": "{{key}}", "Strategy": "ModernJobsCount", "JobsCount":1, "InputArguments": "{"textInput":"test"}"}}”

{“message”:“startJobParameters must not be null”,“errorCode”:0,“resourceIds”:null}

These seem to match to me?

And again, no code snippet for .net so a conversio nthat works for that would be helpful - though I’m unsure what to convert at this point!

My .net body call looks like
image

which seems perfect to me, but getting the same error.

I’m wondering if it’s to do with my process? The arguments are textInput as an input string and processStatus an output string.

Take a look here and adapt correctly the InputArguments: Jobs Requests

Thanks, It occurred to me reviewing this that the backslashes need to be in the body when it goes through. Therefore, I set InputAeguments using

inputArguments = “, ““InputArguments””: “”{"“textInput"”: " & Chr(92) & Chr(34) & argumentValue & Chr(92) & Chr(34) & “}””"

which then includes these and submits ok

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