Thanks for getting in touch and I’m sorry to hear that you’re having these issues.
Could you check the Octopus server log at the time you were trying to add the SSH target as that should have some further clues as to what caused the 500: Internal Error.
2018-10-18 14:36:31.3261 6684 67 ERROR Unhandled error on request: http://test–octopus01.mydomain.com/api/machines b4556787887hdgfh64657575 by puppet-sa-dq : Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path ‘Endpoint’, line 1, position 33.
Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path ‘Endpoint’, line 1, position 33.
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Octopus.Core.Serialization.InheritedClassConverter2.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Octopus.Server.Web.Infrastructure.NancyContextExtensions.Bind(Request request, Type modelType) at Octopus.Server.Web.Infrastructure.NancyContextExtensions.BindAndValidate(NancyContext context, IModelValidatorLocator validatorLocator, Type modelType) at Octopus.Server.Web.Infrastructure.NancyContextExtensions.BindAndValidate[TModel](NancyContext context, IModelValidatorLocator validatorLocator) at Octopus.Server.Web.Infrastructure.Api.Responder1.BindAndValidateTModel
at Octopus.Server.Web.Infrastructure.Api.CreateResponseDescriptor2.Responder.ExecuteRegistered() at Octopus.Server.Web.Infrastructure.Api.Responder1.Respond(TDescriptor options, NancyContext context)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object x)
at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)
It looks like there was a missing { before CommunicationStyle in the data for the --post-data argument. If you add that missing { to your script (so it looks something like this "{\"Endpoint\": {\"CommunicationStyle\":\"Ssh\",\"AccountId\":\"$accountId\",\"Host\":\"$localip\",\"Port\":\"22\",\"Fingerprint\":\"$fingerprint\"},\"EnvironmentIds\":[\"$environmentId\"],\"Name\":\"$machineName\",\"Roles\":[\"linux\"]}") it should work successfully.
If it still is throwing errors, please provide the script you’re using and I’ll have a look and see what is causing the issue.