Deployment API Promoting Release Error

Hi,

I’m trying to use the API to promote a release from one environment to the next. I can make other api calls successfully such as retrieving information and my user is a system administrator in Octopus.

Octopus Server version is 2.5.10.567

The call I’m trying is:
POST /api/deployments {EnvironmentId: 'Environments-65', ReleaseId: 'releases-4217'}

Based on the docs at https://github.com/OctopusDeploy/OctopusDeploy-Api/wiki/Deployments I believe this should be enough to promote the release ‘releases-4217’ into the environment ‘Environments-65’.

The response I receive however is:

{ ErrorMessage: 'Value cannot be null.\r\nParameter name: instance',
  FullException: 'System.ArgumentNullException: Value cannot be null.\r\nParameter name: instance\r\n   at System.ComponentModel.DataAnnotations.ValidationContext..ctor
(Object instance, IServiceProvider serviceProvider, IDictionary`2 items)\r\n   at Nancy.Validation.DataAnnotations.DataAnnotationsValidatorAdapter.<Validate>d__4.MoveNe
xt()\r\n   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)\r\n   at Nancy.Validation.DataAnnotations.PropertyValidator.Validate(
Object instance)\r\n   at Nancy.Validation.DataAnnotations.DataAnnotationsValidator.Validate(Object instance, NancyContext context)\r\n   at Octopus.Platform.Web.Api.Re
sponder`1.BindAndValidate[TModel]() in y:\\work\\refs\\heads\\master\\source\\Octopus.Platform.Web\\Api\\Responder.cs:line 84\r\n   at Octopus.Platform.Web.Api.CreateRe
sponseDescriptor`2.Responder.Execute() in y:\\work\\refs\\heads\\master\\source\\Octopus.Platform.Web\\Api\\CreateResponseDescriptor.cs:line 34\r\n   at Octopus.Platfor
m.Web.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in y:\\work\\refs\\heads\\master\\source\\Octopus.Platform.Web\\Api\\Responder.cs:line 163\r\n
  at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n   at CallSite.Target(Closure , CallSite , Object , Ob
ject , NancyContext )\r\n   at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass5.<.ctor>b__2(Object o) in y:\\work\\refs\\heads\\master\\source\\Octopus.Se
rver\\Web\\Api\\OctopusRestApiModule.cs:line 47\r\n   at CallSite.Target(Closure , CallSite , Func`2 , Object )\r\n   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b_
_3(Object parameters, CancellationToken context)' }

Any help would be much appreciated. Thank you.

Hi Kym,

Could you send a copy of the full HTTP request? You’ll need to make sure for example that the content type is application/json.

Paul

Hi Paul,

thanks for the response. After capturing the request I realised I wasn’t sending through the json body correctly. It’s just one of those days. This can be closed.

Thanks.