You didn't share enough information, bu t I assume you're on the right track by using the HTTP PATCH method with a payload that specifies the operation (op
) as add
, and provides the necessary details about the file source you want to add (value
).
However, if you're receiving a 202 Accepted
status code but the source isn't being added, it might be for the following reasons :
Are you sure that you have the correct endpoint for adding a source to your project? because the endpoint typically looks like this: https://api.{location}.language.azure.com/language/:query-knowledgebases/projects/{projectName}/sources
where {location}
is your Azure service location (example westus
, eastus2
) and {projectName}
is the name of your QnA project.
You must also confirm that your request includes a valid Authorization
header with a Bearer token. Azure REST APIs require proper authentication, and missing or invalid tokens can lead to requests not being processed correctly.
In your case, please be aware that use of PATCH
is correct for modifying existing resources, including adding sources to your project must be aligned with the request method which needs to bes set to PATCH
.
The payload format seems correct for a PATCH operation, specifying the operation as add
like the following :
-
displayName
: A user-friendly name for the source. -
sourceUri
: The URL where the file can be downloaded. -
sourceKind
: The type of source, which isfile
in your case. -
source
: This should typically be the name you want to assign to this source for identification within your project, but it's not usually a required field for adding a file source. Confirm this field's purpose and whether it's necessary for your specific use case Please test and tell us :)