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?

  • Hi, you have an example at https://www.ibm.com/developerworks/library/co-ind-ilog-cplex/index.html and API at https://www.ibm.com/support/knowledgecenter/en/SSQVNT_3.9.0/ilog.odms.ide.odm.enterprise.help/ODME/Ref_manuals/restAPI/jobrest.html you my see that the API is different from docplexcloud – Alex Fleischer Oct 24 '18 at 06:48
  • Hello, thank you! I have seen this samples using Java, the thing is we are trying to use .NET (C#), and we can't find any samples using directly the API (this is why we are using curl to test), there are only samples using the Java Client library. Do you know any resources that are agnostic? Anything not Java related? That will be awsome. – O. Escobedo Oct 24 '18 at 16:02

1 Answers1

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

halfer
  • 19,824
  • 17
  • 99
  • 186
Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15
  • Thanks your references helped me to find a wadl and a xsd with wich I could figure out how to send the structure of my json. – O. Escobedo Oct 25 '18 at 20:34