Error when creatin new release through REST api

When trying to create new release through the REST api like this

URL: http://myhost/Api/Projects/1/Releases/Add
VERB: POST
BODY: Version=1.0.16&PackageVersions[0].Version=1.0.9&PackageVersions[0].Id=WebApplication3&ProjectId=1

I receive the following error:

{
“errors”: [
“An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details.”
]
}

I can successfuly create release by POSTing on the page with the same body
URL: http://myhost/Releases/Create?projectId=4

Is it a bug in API or I’m using it in a wrong way?

Hi,

Can you try creating a release using the Octo.exe command line tool, and using Fiddler to see what the request looks like and how it differs to yours?

Off the top of my head the URL shouldn’t have /Add at the end, and you may need to encode the body as JSON rather than POST data.

The command line tool is downloadable from here:

Paul

Hi

Thank you!

I didn’t realize that you have command line tool. It works and makes things much easier now ))