Legacy Dev Forum Posts

 View Only

Sign Up

.net SDK bug in UsersApi.PutUserIdRoles

  • 1.  .net SDK bug in UsersApi.PutUserIdRoles

    Posted 06-05-2025 19:19

    Jacob | 2017-01-28 00:31:58 UTC | #1

    UsersApi.PutUserIdRoles generates the following exception:

    ININ.PureCloudApi.Client.ApiException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'ININ.PureClou dApi.Model.UserAuthorization' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized f rom a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path '', line 1, position 1. at ININ.PureCloudApi.Client.ApiClient.Deserialize(IRestResponse response, Type type) at ININ.PureCloudApi.Api.UsersApi.PutUserIdRolesWithHttpInfo(String userId, List`1 body)

    My guess is you define the wrong return type?


    tim.smith | 2017-01-31 15:53:42 UTC | #2

    Jacob, post:1, topic:862
    My guess is you define the wrong return type?

    Yep. The response type is documented incorrectly. I've created API-2272 to fix the contract.

    If you need to work around it immediately, you can customize the response class and make a custom build of the SDK with a pretty simple schema that can deserialize this:

    [
      {
        "userId": "guid",
        "orgId": "guid",
        "roleId": "guid"
      }
    ]

    system | 2017-08-28 19:31:41 UTC | #3


    This post was migrated from the old Developer Forum.

    ref: 862