I am trying to add an asignee to a space but the response is telling "StatusCode 400: ReasonPhrase Bad Request"
This is my code..
HttpClient Client = null;
HttpResponseMessage Response = null;
clsQlikSpaceAssignment Assignment = new();
Assignment.assigneeId = UserId;
Assignment.type = "shared";
Assignment.roles = new();
Assignment.roles.Add("basicconsumer");
Client = new();
Client.BaseAddress = new Uri(sAPIURL);
Client.DefaultRequestHeaders.Clear();
Client.DefaultRequestHeaders.Add("Authorization", "Bearer " + sAPIKey);
sCommand = "spaces/" + SpaceId + "/assignments";
var body = JsonSerializer.Serialize<clsQlikSpaceAssignment>(Assignment);
Response = Client.PostAsJsonAsync(sCommand, body).Result;
the request message has Content header as "Content-type:application.json" and the reuqest has
URi = "<mytennant>/api/v1/spaces/<spaceid>/assignments
content (I am assuming that c# is adding the "\" to deal with it corrcly internally.
"{\"type\":\"shared\",\"roles\":[\"basicconsumer\"],\"assigneeId\":\"BwiHge2rZAArjLqA16ikB5ZeP_6eZkS2\"}"
and yes the dear has the bearer token of my API key. Not I am able to read data, just able to post it correctly.