Export-import-refresh in custom question answering

You might want to create a copy of your custom question answering project or related question and answer pairs for several reasons:

  • To implement a backup and restore process
  • To integrate with your CI/CD pipeline
  • To move your data to different regions

Prerequisites

  • An Azure subscription. You can create one for trial before you begin.
  • A language resource with the custom question answering feature enabled. Remember your Microsoft Entra ID, Subscription, language resource name you selected when you created the resource.

Export a project programmatically

To automate the export process, use the export functionality of the authoring API

Import a project programmatically

To automate the import process, use the import functionality of the authoring API

Refresh a URL programmatically

To automate the URL refresh process, use the update sources functionality of the authoring API

The update sources example in the Authoring API docs shows the syntax for adding a new URL-based source. An example query for an update would be as follows:

Variable name Value
ENDPOINT This value can be found in the Keys & Endpoint section when examining your resource from the Azure portal. An example endpoint is: https://chinaeast2.api.cognitive.azure.cn/ and you only need to add the region-specific portion of chinaeast2. The endpoint path is already present.
API-KEY This value can be found in the Keys & Endpoint section when examining your resource from the Azure portal. You can use either Key1 or Key2. Always having two valid keys allows for secure key rotation with zero downtime. The key value is part of the sample request.
PROJECT-NAME The name of project where you would like to update sources.
curl -X PATCH -H "Ocp-Apim-Subscription-Key: {API-KEY}" -H "Content-Type: application/json" -d '[
  {
    "op": "replace",
    "value": {
      "displayName": "source5",
      "sourceKind": "url",
      "sourceUri": https://download.microsoft.com/download/7/B/1/7B10C82E-F520-4080-8516-5CF0D803EEE0/surface-book-user-guide-EN.pdf,
      "refresh": "true"
    }
  }
]'  -i 'https://{ENDPOINT}.api.cognitive.azure.cn/language/query-knowledgebases/projects/{PROJECT-NAME}/sources?api-version=2021-10-01'

Next steps