Open prajon84 opened 1 year ago
@davidnmbond
upload attachment functionality is not yet supported. you need to fork repo and add your custom component to add attachment.
////sample code.. var options = new RestClientOptions("") { MaxTimeout = -1, }; var client = new RestClient(options); var request = new RestRequest("https://{your_instance}.service-now.com/api/now/attachment/upload", Method.Post); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Bearer {your bearer token}"); request.AlwaysMultipartFormData = true; request.AddParameter("table_name", "{table name}"); request.AddParameter("table_sys_id", "{table sys Id}"); request.AddFile("uploadFile", "/path/to/file"); RestResponse response = await client.ExecuteAsync(request); Console.WriteLine(response.Content);
Thanks @KKSatish and no worries. I deviated away from this path long back.
👋
I am looking for endpoint to "upload attachments". I find "download attachments" endpoint but nothing for upload.
https://github.com/panoramicdata/ServiceNow.Api/blob/main/ServiceNow.Api/ServiceNowClient.cs
Please guide 🙏