httpcurlxlrelease

How to create and start a XL Release release with a http request?


I need help because I'm not good with HTTP Requests.

I am trying to create a Release on my XL Release server with a HTTP request. Right now I'm doing it with Curl, in a batch file, like that

curl "https://{ID}:{password}@{IP}:{port}/api/v1/templates/Applications/Folder{IDFolder}/create" -i -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d %0\..\ReleaseConfig.json

The data file, which is in the same directory as the script, I'm calling is a json like that :

{ "releaseTitle" : "API Test", "releaseVariables" : { }, "releasePasswordVariables" : { }, "scheduledStartDate" : null, "autoStart" : false }

The problem is, I get an error like that while executing my command :

RESTEASY003065: Cannot consume content type

Do you have any idea what can help my case ?

Thanks


Solution

  • By looking at your filename, it seems that you are on Windows. I suspect you can't escape your Content-type with quote, you have to use double quotes. Also, to pass a file as POST data, you have to use an @, like this:

    curl "https://{ID}:{password}@{IP}:{port}/api/v1/templates/Applications/Folder{IDFolder}/create" -i -X POST -H "Content-Type:application/json" -H "Accept:application/json" -d @%0\..\ReleaseConfig.json