Ryan_Keown | 2017-09-06 15:05:07 UTC | #1
I'm trying to import the users to use in our reporting, but the .NET NuGet package isn't returning all the users. I've contacted PureCloud support, but they sent me here. Case: 0002049733
The .NET library will not return the inactive or deleted users, as well as a couple active users. I'm not getting an error code only successful responses. However, the responses say there are more records than what is being returned. The response says the total is 110, but with both pages I only get 91 records. Page one contains 82, and page two contains 9. I'm using the C# the UserAPI PostUsersSearch, because the Search API threw an exception trying to deserialize the JSON result.
Request: Query for: Fields: "state" Values: "active", "inactive", "deleted"
{class UserSearchRequest { SortOrder: Asc SortBy: name PageSize: 100 PageNumber: 1 Sort: Expand: Query: System.Collections.Generic.List`1[PureCloudPlatform.Client.V2.Model.UserSearchCriteria] } }
This is what I get back from the Search API when searching for the same criteria.
{ "Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'PureCloudPlatform.Client.V2.Model.JsonNode' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\r\n 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 from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\r\nPath 'results', line 1, position 349."}
tim.smith | 2017-09-06 15:23:23 UTC | #2
Unfortunately, search doesn't support deleted users. You can use GET /api/v2/users?state=deleted to retrieve deleted users.
The generic search endpoint POST /api/v2/search unfortunately will not work with the SDKs. The dev team has created that API in such a way that its response cannot be described as a standard contract. Because the SDKs are generated based on the documented contracts, the SDK cannot parse the response from that API.
Ryan_Keown | 2017-09-06 17:12:24 UTC | #3
That allowed me to get the active and deleted users, but it returns the active users when I try to get the inactive users.
tim.smith | 2017-09-06 19:12:29 UTC | #4
Ok... after a lot of digging, I've uncovered the following facts:
- A user may exist in one of 3 states: active, inactive, or deleted
POST /api/v2/users/search is currently in a state where it returns the number of results, but doesn't actually return any results for deleted or inactive users. Tracked as SRCH-1439, this new feature to return results under these circumstances is currently unprioritized.POST /api/v2/search will return results for users in any state, but you can't use it with the SDK (see note above)GET /api/v2/users only accepts active or deleted for the state query param. Tracked as API-2835 to also accept the inactive value, currently unprioritized.
system | 2017-10-07 18:38:36 UTC | #5
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 1768