Unable to Create Organisation through GroupShare API

I'm building an application which communicates with GroupShare using the REST API, and am encountering an exception when I try to create an organisation.

First of all, we built our own API wrapper to communicate with the GroupShare REST API, and we had this successfully creating orgnisations. For our own reasons we had to create a new VM on which GroupShare is installed, which then required a fresh install of GroupShare on said VM. Since then our API wrapper encounters the aforementioned exception.

I've also tried using Romulus' GroupShareKit, and although both this and our wrapper API can authenticate against the GroupShare server, then query and successfully obtain the root organisation, we still encounter the same exception when sending the request to create a new organisation.

[I should add that I've had to fork and modify GroupShareKit to include an Organziations.Create method - pull request possibly coming soon.]

As per the instructions here, this is the JSON which I'm POSTing to the server:

{
    "UniqueId": "e21c9e02-8b4c-4274-9b9c-8ec76f85863a",
    "Name": "86031",
    "Description": "Test Groupshare Org",
    "Path": "/86031",
    "ParentOrganizationId": "f82b6604-9a9e-47bb-90c1-d907b9db7594",
    "ChildOrganizations": []
}

Other things I've tried:

  • not setting "UniqueId" - if not set then I can see that an empty GUID ("00000000-0000-0000-0000-000000000000") is sent
  • setting "Path" as "/"
  • setting "ChildOrganizations" to NULL

None of the above makes any difference. The response is always:

{
    "Message": "An error has occurred.",
    "ExceptionMessage": "Object reference not set to an instance of an object.",
    "ExceptionType": "System.NullReferenceException",
    "StackTrace": "   at Sdl.StudioServer.Services.Management.RestApi.Controllers.OrganizationsController.AddOrganization(Organization organization)
                    at lambda_method(Closure , Object , Object[] )
                    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters)
                    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
                    at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.<ExecuteAsync>b__4()
                    at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"
}


In case it matters, the username and password are those pre-configured for the "sa" user, and no other configuration has taken place on GroupShare other than as required during the installation procedure.

Parents Reply
  • I undertook both those steps but the problem remains.

    My log file shows that the new user was authenticated (using GroupShareClient.AuthenticateClient(...) ) and I can see that the new organisation was retrieved (using myGroupShareClient.Organization.GetAll(new OrganizationRequest(true)).Result.LastOrDefault(); - a little dirty, I know, but should suffice for testing) but a call to

    var newOrganization = myGroupShareClient.Organization.Create(newName, order.OrderName, parentOrganization).Result;

    Results in the exception...

    System.AggregateException: One or more errors occurred. ---> Sdl.Community.GroupShareKit.Exceptions.ApiException: An error occurred with this API request
    at Sdl.Community.GroupShareKit.Http.Connection.HandleErrors(IResponse response) in C:\ [...] \groupsharekit.net\Sdl.Community.GroupShareKit\Http\Connection.cs:line 235
    at Sdl.Community.GroupShareKit.Http.Connection.<RunRequest>d__19.MoveNext() in C:\ [...] \groupsharekit.net\Sdl.Community.GroupShareKit\Http\Connection.cs:line 212
Children