0

I am trying to create a new job using the REST API on CPLEX Enterprise Server.

I am using curl and this is my command

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d "{\"attachments\": [{ \"name\": \"week_granularity.mod\", \"length\": 0},{\"name\": \"Conteo.dat\",\"length\": 0}]}"; -k -u user:password "https://MYSERVER/odme/optimserver/rest/v1/jobs"

I am sending a json file as a parameter with my mod file and a dat file and i send the POST request to a local server.

curl return this error

Error 500: javax.servlet.ServletException: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "attachments" (Class ilog.odms.optimserver.job.IloCreateJobData), not marked as ignorable at [Source: com.ibm.ws.webcontainer.srt.http.HttpInputStream@1879bda6; line: 1, column: 18] (through reference chain: ilog.odms.optimserver.job.IloCreateJobData["attachments"])

However I made a test in api swagger: https://api-swagger-oaas.docloud.ibmcloud.com/api_swagger/#!/jobs/createJob with the same curl command and works fine but when I used my local URL doesn't work.

Does anyone know if I am missing some configuration on my local server?

4

1 回答 1

0

The REST APIs for DOCPLEXCLOUD and CPLEX Enterprise Server are different.

Many different APIs examples for DOCPLEXCLOUD : https://developer.ibm.com/docloud/documentation/docloud/

Indeed the examples for CPLEX enterprise server are in Java but you could call Java executables from C# through external calls.

PS:

Do not hesitate to log wishes at https://ibmanalytics.ideas.aha.io/?project=CPLEX

于 2018-10-24T16:16:32.617 回答