Пример #1
0
        public async Task <bool> PostStepTemplate(NewStepTemplateRequest stepTemplate, string username = null, string password = null)
        {
            using (HttpClient client = new HttpClient(clientHandler))
            {
                client.BaseAddress = new Uri(_url);

                AuthorizeClientWithUser(client, username, password);

                var response = await client.PostAsync("/api/step-templates", new StringContent(JsonConvert.SerializeObject(stepTemplate), Encoding.UTF8, "application/json"));

                var contents = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    return(true);
                }
                else
                {
                    throw new Exception("Error sending Workflow template request, returned with error " + response.StatusCode);
                }
            }
        }
Пример #2
0
 public async Task <string> PostStepTemplate(NewStepTemplateRequest stepTemplate, string idToken)
 {
     return((await SendPostRequest("/api/step-templates", stepTemplate, true)).Value <string>("objectRefId"));
 }