How to refresh url programatically in language studio using c#

KuppiReddygariSamthrushaReddy-3789 66 Reputation points
2023-03-21T12:20:51.95+00:00

I'm trying to refresh the url (I'm using excel sheet blob url) in c# to update the kb's.

Code :

using System.Net.Http; using System.Net.Http.Headers; HttpClient client = new HttpClient(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Patch, "https://{ENDPOINT}.api.cognitive.microsoft.com/language/query-knowledgebases/projects/{PROJECT-NAME}/sources?api-version=2021-10-01"); request.Headers.Add("Ocp-Apim-Subscription-Key", "{API-KEY}"); request.Content = new StringContent("[\n {\n "op": "replace",\n "value": {\n "displayName": "source5",\n "sourceKind": "url",\n "sourceUri": https://download.microsoft.com/download/7/B/1/7B10C82E-F520-4080-8516-5CF0D803EEE0/surface-book-user-guide-EN.pdf,\n "refresh": "true"\n }\n }\n]"); request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsString

I'm using this code in c#. I'm getting bad request as a response.

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,895 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.