Hi all, I hope this is the correct place to ask such a technical question.
I'm developing a c# helper application that we'd like to use in order to automate some tedious and error proning tasks that are currently done using the exstream console web application.
I'm referring to API depicted here: (
https://developer.opentext.com/ce/products/exstream/apis/exstream-rest-api
)
All get operations are working without problems. I'm getting error in the PUT/POST. They are all failing with an HTTP 403 error code (Forbidden)
This is the code that I wrote in order to get the authentication Token.
var form = new Dictionary<string, string>
{
["grant_type"] = "password",
["username"] = username,
["password"] = password,
["client_id"] = "Exstream"
};
var response = await client.PostAsync(
$"{baseUrl}/otdstenant/collaudo/otdsws/oauth2/token",
new FormUrlEncodedContent(form));
This is the code that I'm trying to change the state of a flowstript from APPROVED to DRAFT.
var token = await GetToken();
var endpoint = $"{baseUrl}/design/api/v1/resources/{Uri.EscapeDataString(domain)}/{Uri.EscapeDataString(id)}/state";
var request = new HttpRequestMessage(HttpMethod.Put, endpoint);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json"));
request.Headers.Add("X-Tenant", Uri.EscapeDataString(tenant));
request.Content = JsonContent.Create(new
{
state,
auditedComment = comment,
locked = false
});
var response = await client.SendAsync(request);
var body = await response.Content.ReadAsStringAsync();
The response fails with status 403, even if the user is the tenant admin.
Do you have any suggestion?
Thanks in advance,
Paolo