Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MikeRalphson/494d317baa94afe85c248dac7a633e10 to your computer and use it in GitHub Desktop.
Save MikeRalphson/494d317baa94afe85c248dac7a633e10 to your computer and use it in GitHub Desktop.
Cognitive Search API - SharePoint Data Source
{
"info": {
"_postman_id": "64db4d98-d050-4f4b-8a02-86be628160f9",
"name": "Cognitive Search API - User Group",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "641744"
},
"item": [
{
"name": "Create SharePoint Data Source",
"request": {
"method": "POST",
"header": [
{
"key": "api-key",
"value": "{{admin-key}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\": \"sharepoint-datasource\",\r\n \"type\": \"sharepoint\",\r\n \"credentials\": {\r\n \"connectionString\": \"SharePointOnlineEndpoint={{SharePointOnlineEndpoint}};ApplicationId={{ApplicationId}};ApplicationSecret={{ApplicationSecret}};TenantId={{TenantId}}\"\r\n },\r\n \"container\": {\r\n \"name\": \"defaultSiteLibrary\",\r\n \"query\":\"includeLibrary={{SharePointLibrary}};additionalColumns={{additionalColumns}}\"\r\n\r\n }\r\n}"
},
"url": {
"raw": "https://{{service-name}}.search.windows.net/datasources?api-version=2021-04-30-Preview",
"protocol": "https",
"host": [
"{{service-name}}",
"search",
"windows",
"net"
],
"path": [
"datasources"
],
"query": [
{
"key": "api-version",
"value": "2021-04-30-Preview"
}
]
}
},
"response": []
},
{
"name": "Create an index",
"request": {
"method": "POST",
"header": [
{
"key": "api-key",
"value": "{{admin-key}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\" : \"sharepoint-index\",\r\n \"fields\": [\r\n { \"name\": \"id\", \"type\": \"Edm.String\", \"key\": true, \"searchable\": false },\r\n { \"name\": \"metadata_spo_item_name\", \"type\": \"Edm.String\", \"key\": false, \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"metadata_spo_item_path\", \"type\": \"Edm.String\", \"key\": false, \"searchable\": false, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"metadata_spo_item_content_type\", \"type\": \"Edm.String\", \"key\": false, \"searchable\": false, \"filterable\": true, \"sortable\": false, \"facetable\": true },\r\n { \"name\": \"metadata_spo_item_last_modified\", \"type\": \"Edm.DateTimeOffset\", \"key\": false, \"searchable\": false, \"filterable\": false, \"sortable\": true, \"facetable\": false },\r\n { \"name\": \"metadata_spo_item_size\", \"type\": \"Edm.Int64\", \"key\": false, \"searchable\": false, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"content\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n\r\n\r\n { \"name\": \"Title\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"Year\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"DocumentType\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"Critical\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"LastReviewed\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"DocumentOwner\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"AnnualCosts\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false },\r\n { \"name\": \"FullFilePath\", \"type\": \"Edm.String\", \"searchable\": true, \"filterable\": false, \"sortable\": false, \"facetable\": false }\r\n\r\n \r\n ]\r\n}"
},
"url": {
"raw": "https://{{service-name}}.search.windows.net/indexes/?api-version=2021-04-30-Preview",
"protocol": "https",
"host": [
"{{service-name}}",
"search",
"windows",
"net"
],
"path": [
"indexes",
""
],
"query": [
{
"key": "api-version",
"value": "2021-04-30-Preview"
}
]
}
},
"response": []
},
{
"name": "Create Indexer",
"request": {
"method": "POST",
"header": [
{
"key": "api-key",
"value": "{{admin-key}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\" : \"sharepoint-indexer\",\r\n \"dataSourceName\" : \"sharepoint-datasource\",\r\n \"targetIndexName\" : \"sharepoint-index\",\r\n \"parameters\": {\r\n \"batchSize\": null,\r\n \"maxFailedItems\": null,\r\n \"maxFailedItemsPerBatch\": null,\r\n \"base64EncodeKeys\": null,\r\n \"configuration\": {\r\n \"indexedFileNameExtensions\" : \".pdf, .docx\",\r\n \"excludedFileNameExtensions\" : \".png, .jpg\",\r\n \"dataToExtract\": \"contentAndMetadata\"\r\n }\r\n },\r\n \"schedule\" : { },\r\n \"fieldMappings\" : [\r\n { \r\n \"sourceFieldName\" : \"metadata_spo_site_library_item_id\", \r\n \"targetFieldName\" : \"id\", \r\n \"mappingFunction\" : { \r\n \"name\" : \"base64Encode\" \r\n } \r\n }\r\n ]\r\n}"
},
"url": {
"raw": "https://{{service-name}}.search.windows.net/indexers?api-version=2021-04-30-Preview",
"protocol": "https",
"host": [
"{{service-name}}",
"search",
"windows",
"net"
],
"path": [
"indexers"
],
"query": [
{
"key": "api-version",
"value": "2021-04-30-Preview"
}
]
}
},
"response": []
},
{
"name": "Get Indexer Status",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "api-key",
"value": "{{admin-key}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\" : \"sharepoint-indexer\",\r\n \"dataSourceName\" : \"sharepoint-datasource\",\r\n \"targetIndexName\" : \"sharepoint-index\",\r\n \"parameters\": {\r\n \"batchSize\": null,\r\n \"maxFailedItems\": null,\r\n \"maxFailedItemsPerBatch\": null,\r\n \"base64EncodeKeys\": null,\r\n \"configuration\": {\r\n \"indexedFileNameExtensions\" : \".pdf, .docx\",\r\n \"excludedFileNameExtensions\" : \".png, .jpg\",\r\n \"dataToExtract\": \"contentAndMetadata\"\r\n }\r\n },\r\n \"schedule\" : { },\r\n \"fieldMappings\" : [\r\n { \r\n \"sourceFieldName\" : \"metadata_spo_site_library_item_id\", \r\n \"targetFieldName\" : \"id\", \r\n \"mappingFunction\" : { \r\n \"name\" : \"base64Encode\" \r\n } \r\n }\r\n ]\r\n}"
},
"url": {
"raw": "https://{{service-name}}.search.windows.net/indexers/sharepoint-indexer/status?api-version=2021-04-30-Preview",
"protocol": "https",
"host": [
"{{service-name}}",
"search",
"windows",
"net"
],
"path": [
"indexers",
"sharepoint-indexer",
"status"
],
"query": [
{
"key": "api-version",
"value": "2021-04-30-Preview"
}
]
}
},
"response": []
},
{
"name": "Run Indexer",
"request": {
"method": "POST",
"header": [
{
"key": "api-key",
"value": "{{admin-key}}",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\" : \"sharepoint-indexer\",\r\n \"dataSourceName\" : \"sharepoint-datasource\",\r\n \"targetIndexName\" : \"sharepoint-index\",\r\n \"parameters\": {\r\n \"batchSize\": null,\r\n \"maxFailedItems\": null,\r\n \"maxFailedItemsPerBatch\": null,\r\n \"base64EncodeKeys\": null,\r\n \"configuration\": {\r\n \"indexedFileNameExtensions\" : \".pdf, .docx\",\r\n \"excludedFileNameExtensions\" : \".png, .jpg\",\r\n \"dataToExtract\": \"contentAndMetadata\"\r\n }\r\n },\r\n \"schedule\" : { },\r\n \"fieldMappings\" : [\r\n { \r\n \"sourceFieldName\" : \"metadata_spo_site_library_item_id\", \r\n \"targetFieldName\" : \"id\", \r\n \"mappingFunction\" : { \r\n \"name\" : \"base64Encode\" \r\n } \r\n }\r\n ]\r\n}"
},
"url": {
"raw": "https://{{service-name}}.search.windows.net/indexers/sharepoint-indexer/run?api-version=2021-04-30-Preview",
"protocol": "https",
"host": [
"{{service-name}}",
"search",
"windows",
"net"
],
"path": [
"indexers",
"sharepoint-indexer",
"run"
],
"query": [
{
"key": "api-version",
"value": "2021-04-30-Preview"
}
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "service-name",
"value": "clever-standard-cognitive-search",
"type": "string"
},
{
"key": "admin-key",
"value": "00AAjgOItW72dXgpXfexn4jd4EGogZ9pdIFQSPpqzcAzSeBRJG7R",
"type": "string"
},
{
"key": "ApplicationId",
"value": "aaf72f62-aabf-aa5c-a181-4e4e4b1032a9",
"type": "string"
},
{
"key": "ApplicationSecret",
"value": "Sqk8Q~w367wCsvACMv21gLoxzZO_NO-t_mMSicWz",
"type": "string"
},
{
"key": "TenantId",
"value": "22aad981-eaa6-475f-aac3-3afca0c35261",
"type": "string"
},
{
"key": "SharePointOnlineEndpoint",
"value": "https://gocleverpointcom.sharepoint.com/sites/Teailspin-Records-CognitiveSearchDemo",
"type": "string"
},
{
"key": "SharePointLibrary",
"value": "https://gocleverpointcom.sharepoint.com/sites/Teailspin-Records-CognitiveSearchDemo/Shared Documents/Forms/AllItems.aspx",
"type": "string"
},
{
"key": "additionalColumns",
"value": "Title,Year,DocumentType,Critical,LastReviewed,DocumentOwner,AnnualCosts,FullFilePath",
"type": "string"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment