Veri Varlığı (Azure Veri Kataloğu REST API)

Not ekle

Bir varlığa not ekler.

etag özelliği isteğe bağlıdır ve eşzamanlılık denetimi için kullanılır.

POST https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}/{view_item_id}/{nested_view_name}?api-version={api-version}

Not

Bazı HTTP istemci uygulamaları, sunucudan bir 302'ye yanıt olarak istekleri otomatik olarak yeniden verebilir, ancak genellikle istekten Yetkilendirme üst bilgilerini kaldırır. ADC'ye istek göndermek için Yetkilendirme üst bilgisi gerektiğinden, ADC tarafından belirtilen yeniden yönlendirme konumuna bir istek yeniden verilirken Yetkilendirme üst bilgisinin hala sağlandığından emin olmanız gerekir. Aşağıda .NET HttpWebRequest nesnesini kullanarak bunu gösteren örnek kod verilmiştir.

Uri parametreleri

Ad Açıklama Veri Türü
Catalog_name Kataloğun adı veya varsayılan kataloğu kullanmak için "DefaultCatalog". Dize
view_name Veri Varlığı Görünümünün adı. Dize
view_item_id Görünüm öğesinin kimliği. Dize
nested_view_name İç içe görünüm öğesinin adı. Dize
api-sürümü API sürümü. Dize

Örnek: Uzman Ekleme

POST https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b0...1be45ecd462a/experts?api-version=2016-03-30
Content-Type: application/json
x-ms-client-request-id:   13d9f885…a92d-8a9f8cf9f707
Authorization: Bearer eyJ0eX ... FWSXfwtQ

Gövde

{
    "etag": "59085E253E2244A59F664A2F447E675E",
    "properties":
    {
        "fromSourceSystem": false,
        "key": "22c3fa019b3945dc97143ebc3ad74cbf--1111fa019b3945dc97143ebc3ad74cbf",
        "expert":
        {
            "upn": "expert1@contoso.com",
            "objectId": "1111fa019b3945dc97143ebc3ad74cbf"
        },
    }
}

Örnek: Sözlük Terimi Etiketleri Ekleme

POST https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b0...1be45ecd462a/termTags?api-version=2016-03-30

Üst bilgi

Content-Type: application/json
x-ms-client-request-id:   13d9f885…a92d-8a9f8cf9f707
Authorization: Bearer eyJ0eX ... FWSXfwtQ

Gövde

{
    "etag": "59085E253E2244A59F664A2F447E675E",
    "properties":
    {
        "fromSourceSystem": false,
        "key": "22c3fa019b3945dc97143ebc3ad74cbf--1111fa019b3945dc97143ebc3ad74cbf",
        "termId": "https://test.catalog.com/catalogs/DefaultCatalog/glossaries/DefaultGlossary/terms/ed975c9d-2fb2-49a3-b6f2-222389cefd7e",
    }
}

Örnek: Sözlük Sütunu Terim Etiketleri Ekleme

POST https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b0...1be45ecd462a/columnTermTags?api-version=2016-03-30

Üst bilgi

Content-Type: application/json
x-ms-client-request-id:   13d9f885…a92d-8a9f8cf9f707
Authorization: Bearer eyJ0eX ... FWSXfwtQ

Gövde

{
    "etag": "59085E253E2244A59F664A2F447E675E",
    "properties":
    {
        "fromSourceSystem": false,
        "key": "22c3fa019b3945dc97143ebc3ad74cbf--1111fa019b3945dc97143ebc3ad74cbf",
        "columnName": "Col1",
        "termId": "https://test.catalog.com/catalogs/DefaultCatalog/glossaries/DefaultGlossary/terms/ed975c9d-2fb2-49a3-b6f2-222389cefd7e",
    }
}

Yanıt

Durum kodları

Kod Description
201 Oluşturulan. İstek yerine getirildi ve yeni bir ek açıklama oluşturuldu.
200 Tamam ögesini seçin. Mevcut bir ek açıklama güncelleştirildi.
412 Önkoşul Başarısız Oldu. En az bir öğedeki ETag uyuşmazlığı nedeniyle istek iptal edildi.

İçerik Türü

application/json

Üst bilgi

HTTP/1.1 201 Created
x-ms-request-id: 72cf83c0…058f2b2a0c68
Location: https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b0...1be45ecd462a/experts/22c3fa019b3945dc97143ebc3ad74cbf-1111fa019b3945dc97143ebc3ad74cbf

Kaydetme veya Güncelleştirme

Yeni bir veri varlığını kaydeder veya aynı kimliğe sahip bir varlık zaten varsa mevcut bir varlığı güncelleştirir. Öğeler isteğe bağlı olarak, iyimser eşzamanlılık denetimini etkinleştirmek için ETag değerleri içerebilir.

GitHub'da başlangıç örneği

İstek

POST https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}?api-version={api-version}  

Not

Bazı HTTP istemci uygulamaları, sunucudan bir 302'ye yanıt olarak istekleri otomatik olarak yeniden verebilir, ancak genellikle istekten Yetkilendirme üst bilgilerini kaldırır. ADC'ye istek göndermek için Yetkilendirme üst bilgisi gerektiğinden, ADC tarafından belirtilen yeniden yönlendirme konumuna bir istek yeniden verilirken Yetkilendirme üst bilgisinin hala sağlandığından emin olmanız gerekir. Aşağıda .NET HttpWebRequest nesnesini kullanarak bunu gösteren örnek kod verilmiştir.

Uri parametreleri

Ad Açıklama Veri Türü
Catalog_name Kataloğun adı veya varsayılan kataloğu kullanmak için "DefaultCatalog". Dize
view_name Veri Varlığı Görünümünün adı. Dize
api-sürümü API sürümü. Dize

POST örneği

POST https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables?api-version=2016-03-30  

Üst bilgi

Content-Type: application/json    
x-ms-client-request-id: 13c45c14…46ab469473f0    
Authorization: Bearer eyJ0eX ... FWSXfwtQ

Gövde örneği

{  
    "roles": [  
        {  
            "role": "Contributor",  
            "members": [  
                {  
                    "objectId": "00000000-0000-0000-0000-000000000201"  
                }  
            ]  
        }  
    ],  
    "properties": {  
        "fromSourceSystem": true,  
        "name": "Orders",  
        "dataSource": {  
            "sourceType": "SQL Server",  
            "objectType": "Table"  
        },  
        "dsl": {  
            "protocol": "tds",  
            "authentication": "windows",  
            "address": {  
                "server": "MyServer.contoso.com",  
                "database": "NORTHWND",  
                "schema": "dbo",  
                "object": "Orders"  
            }  
        },  
        "lastRegisteredBy": {  
            "upn": "user1@contoso.com",  
            "firstName": "User1FirstName",  
            "lastName": "User1LastName"  
        },  
        "containerId": "containers/3b2c00be-...-1f15367f54e4"  
    },  
    "annotations": {  
        "schema": {  
            "roles": [  
                {  
                    "role": "Contributor",  
                    "members": [  
                        {  
                            "objectId": "00000000-0000-0000-0000-000000000201"  
                        }  
                    ]  
                }  
            ],  
            "properties": {  
                "fromSourceSystem": true,  
                "columns": [  
                    {  
                        "name": "OrderID",  
                        "isNullable": false,  
                        "type": "int",  
                        "maxLength": 4,  
                        "precision": 10  
                    },  
                    {  
                        "name": "CustomerID",  
                        "isNullable": true,  
                        "type": "nchar",  
                        "maxLength": 10,  
                        "precision": 0  
                    },  
                    {  
                        "name": "EmployeeID",  
                        "isNullable": true,  
                        "type": "int",  
                        "maxLength": 4,  
                        "precision": 10  
                    },  
                    {  
                        "name": "OrderDate",  
                        "isNullable": true,  
                        "type": "datetime",  
                        "maxLength": 8,  
                        "precision": 23  
                    }  
                ]  
            }  
        }  
    }  
}  

Yanıt

Durum kodları

Kod Description
200 Tamam ögesini seçin. Mevcut bir varlık güncelleştirildi.
201 Oluşturulan. İstek yerine getirildi ve yeni bir varlık oluşturuldu.
412 Önkoşul Başarısız Oldu. En az bir öğedeki ETag uyuşmazlığı nedeniyle istek iptal edildi.

İçerik Türü

application/json

Üst bilgi

HTTP/1.1 201 Created  
x-ms-request-id: 72cf83c0…058f2b2a0c68  
Location: https://e2255231-6dd3-1a0d-a6d8-7fc96dd780c2-mycatalog.api.azuredatacatalog.com/catalogs/MyCatalog/views/tables/042297b0…1be45ecd462a  

Desteklenen Veri Kaynakları

Şu anda desteklenen veri kaynakları nesnelerinin listesi için lütfen Azure Veri Kataloğu desteklenen veri kaynaklarına bakın.

Örnek

Bu örnekte, Azure AD erişim belirtecini alma ve Yazma işlemi gerçekleştirme işlemleri gösterilmektedir.

Not Bu örnekte, kullanıcının varsayılan kataloğunu güncelleştirmek için DefaultCatalog anahtar sözcüğü kullanılır. Alternatif olarak gerçek katalog adını belirtebilirsiniz. Katalog adını bulmak için Azure Veri Kataloğu oturum açın ve Kullanıcı'yı seçin. Katalog adını görürsünüz.

using System;  
using System.Net;  
using Microsoft.IdentityModel.Clients.ActiveDirectory;  
using System.IO;  

...  

//To learn how to register a client app and get a Client ID,  
// see https://msdn.microsoft.com/library/azure/mt403303.aspx#clientID  
static string clientIDFromAzureAppRegistration = "{clientID}";  

static void Main(string[] args)  
{  
    //Note: This example uses the "DefaultCatalog" keyword to update the user's default catalog.  You may alternately  
    //specify the actual catalog name.  
    string catalogName = "DefaultCatalog";  

    string registerJson = Register(catalogName, OrdersJsonWithEveryoneContributor());  

    Console.ReadLine();  
}  

static AuthenticationResult AccessToken()  
{  
    //Get access token:  
    // To call a Data Catalog REST operation, create an instance of AuthenticationContext and call AcquireToken  
    // AuthenticationContext is part of the Active Directory Authentication Library NuGet package  
    // To install the Active Directory Authentication Library NuGet package in Visual Studio,  
    //  run "Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory" from the nuget Package Manager Console.  

    //Resource Uri for Data Catalog API  
    string resourceUri = "https://api.azuredatacatalog.com";  

    //To learn how to register a client app and get a Client ID, see https://msdn.microsoft.com/library/azure/mt403303.aspx#clientID     
    string clientId = clientIDFromAzureAppRegistration;  

    //A redirect uri gives AAD more details about the specific application that it will authenticate.  
    //Since a client app does not have an external service to redirect to, this Uri is the standard placeholder for a client app.  
    string redirectUri = "https://login.live.com/oauth20_desktop.srf";  

    // Create an instance of AuthenticationContext to acquire an Azure access token  
    // OAuth2 authority Uri  
    string authorityUri = "https://login.windows.net/common/oauth2/authorize";  
    AuthenticationContext authContext = new AuthenticationContext(authorityUri);  

    // Call AcquireToken to get an Azure token from Azure Active Directory token issuance endpoint  
    //  AcquireToken takes a Client Id that Azure AD creates when you register your client app.  
    return authContext.AcquireToken(resourceUri, clientId, new Uri(redirectUri), PromptBehavior.RefreshSession);  
}  

static string Register(string catalogName, string json)  
{  
    string location = string.Empty;  
    string fullUri = string.Format("https://api.azuredatacatalog.com/catalogs/{0}/views/{1}?api-version=2016-03-30", catalogName, viewType);  

    //Create a POST WebRequest as a Json content type  
    HttpWebRequest request = System.Net.WebRequest.Create(fullUri) as System.Net.HttpWebRequest;  
    request.KeepAlive = true;  
    request.Method = "POST";  
    try  
    {  
        var response = SetRequestAndGetResponse(request, json);  

        //Get the Response header which contains the data asset ID  
        //The format is: tables/{data asset ID}  
        location = httpWebResponse.Headers["Location"];  
    }  
    catch (WebException ex)  
    {  
        Console.WriteLine(ex.Message);  
        Console.WriteLine(ex.Status);  
        if (ex.Response != null)  
        {  
            // can use ex.Response.Status, .StatusDescription  
            if (ex.Response.ContentLength != 0)  
            {  
                using (var stream = ex.Response.GetResponseStream())  
                {  
                    using (var reader = new StreamReader(stream))  
                    {  
                        Console.WriteLine(reader.ReadToEnd());  
                    }  
                }  
            }  
        }  
        location = null;  
    }  
    return location;  
}  

static HttpWebResponse SetRequestAndGetResponse(HttpWebRequest request, string payload = null)  
{  
    while (true)  
    {  
        //To authorize the operation call, you need an access token which is part of the Authorization header  
        request.Headers.Add("Authorization", AccessToken().CreateAuthorizationHeader());  
        //Set to false to be able to intercept redirects  
        request.AllowAutoRedirect = false;  

        if (!string.IsNullOrEmpty(payload))  
        {  
            byte[] byteArray = Encoding.UTF8.GetBytes(payload);  
            request.ContentLength = byteArray.Length;  
            request.ContentType = "application/json";  
            //Write JSON byte[] into a Stream  
            request.GetRequestStream().Write(byteArray, 0, byteArray.Length);  
        }  
        else  
        {  
            request.ContentLength = 0;  
        }  

        HttpWebResponse response = request.GetResponse() as HttpWebResponse;  

        // Requests to **Azure Data Catalog (ADC)** may return an HTTP 302 response to indicate  
        // redirection to a different endpoint. In response to a 302, the caller must re-issue  
        // the request to the URL specified by the Location response header.  
        if (response.StatusCode == HttpStatusCode.Redirect)  
        {  
            string redirectedUrl = response.Headers["Location"];  
            HttpWebRequest nextRequest = WebRequest.Create(redirectedUrl) as HttpWebRequest;  
            nextRequest.Method = request.Method;  
            request = nextRequest;  
        }  
        else  
        {  
            return response;  
            break;  
        }  
    }  
}  

static string OrdersJsonWithEveryoneContributor()  
{  
    return @"  
    {  
        'roles': [  
            {  
                'role': 'Contributor',  
                'members': [  
                    {  
                        'objectId': '00000000-0000-0000-0000-000000000201'  
                    }  
                ]  
            }  
        ],  
        'properties': {  
            'fromSourceSystem': 'true',  
            'name': 'Orders',  
            'dataSource': {  
                'sourceType': 'SQL Server',  
                'objectType': 'Table'  
            },  
            'dsl': {  
                'protocol': 'tds',  
                'authentication': 'windows',  
                'address': {  
                    'server': 'MyServer.contoso.com',  
                    'database': 'NORTHWND',  
                    'schema': 'dbo',  
                    'object': 'Orders'  
                }  
            },  
            'lastRegisteredBy': {  
                'upn': 'user1@contoso.com',  
                'firstName': 'User1FirstName',  
                'lastName': 'User1LastName'  
            },  
            'containerId': 'containers/a9f8a2e1-d826-7c0c-b186-c7f4334a6b4f'  
        },  
        'annotations': {  
            'schema': {  
                'roles': [  
                    {  
                        'role': 'Contributor',  
                        'members': [  
                            {  
                                'objectId': '00000000-0000-0000-0000-000000000201'  
                            }  
                        ]  
                    }  
                ],  
                'properties': {  
                    'fromSourceSystem': 'true',  
                    'columns': [  
                        {  
                            'name': 'OrderID',  
                            'isNullable': false,  
                            'type': 'int',  
                            'maxLength': 4,  
                            'precision': 10  
                        },  
                        {  
                            'name': 'CustomerID',  
                            'isNullable': true,  
                            'type': 'nchar',  
                            'maxLength': 10,  
                            'precision': 0  
                        },  
                        {  
                            'name': 'EmployeeID',  
                            'isNullable': true,  
                            'type': 'int',  
                            'maxLength': 4,  
                            'precision': 10  
                        },  
                        {  
                            'name': 'OrderDate',  
                            'isNullable': true,  
                            'type': 'datetime',  
                            'maxLength': 8,  
                            'precision': 23  
                        }  
                    ]  
                }  
            }  
        }  
    }";  
}  

Ek Açıklamalarla Alma

Ek açıklama içeren bir veri varlığı alır.

Tüm öğeler için ETag'lerin yanıta eklenmesini isteyen isteğe bağlı Accept üst bilgi parametresini adc.metadata destekler. ETag'leri yanıt olarak almak için en düşük veya tam değerleri kullanın. Geçerli değerler , minimalve fulldeğerleridirnone.

İstek

GET https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}/{view_item_id}?api-version={api-version}  

Not

Bazı HTTP istemci uygulamaları, sunucudan bir 302'ye yanıt olarak istekleri otomatik olarak yeniden verebilir, ancak genellikle istekten Yetkilendirme üst bilgilerini kaldırır. ADC'ye istek göndermek için Yetkilendirme üst bilgisi gerektiğinden, ADC tarafından belirtilen yeniden yönlendirme konumuna bir istek yeniden verilirken Yetkilendirme üst bilgisinin hala sağlandığından emin olmanız gerekir. Aşağıda .NET HttpWebRequest nesnesini kullanarak bunu gösteren örnek kod verilmiştir.

Uri parametreleri

Ad Açıklama Veri Türü
Catalog_name Kataloğun adı veya varsayılan kataloğu kullanmak için "DefaultCatalog". Dize
view_name Veri Varlığı Görünümünün adı. Dize
view_item_id Görünüm öğesinin kimliği. Dize
api-sürümü API sürümü. Dize

GET örneği

GET https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b...1be45ecd462a?api-version=2016-03-30  

Üst bilgi

x-ms-client-request-id: 8091955f…8f5b4c0acede    
Authorization:  Bearer eXJ0eyAiOiJKV1QiLCJhbGciOi...    
Accept: application/json;adc.metadata=full  

Yanıt

Durum kodları

Kod Description
200 Tamam ögesini seçin. Yanıt, istenen varlık görünümünü içeriyor.

İçerik Türü

application/json

Üst bilgi

x-ms-request-id: 1095e88c…caffabd6dabd  
Content-Type:   application/json; charset=utf-8

Gövde

{  
    "id": "https://e2255231-6dd3-1a0d-a6d8-7fc96dd780c2-mycatalog.api.azuredatacatalog.com/catalogs/MyCatalog/views/tables/042297b0-...-1be45ecd462a",  
    "etag": "1234567891",  
    "timestamp": "2015-05-15T03:48:39.2425547",  
    "roles": [  
        {  
            "role": "Contributor",  
            "members": [  
                {  
                    "objectId": "00000000-0000-0000-0000-000000000201"  
                }  
            ]  
        }  
    ],  
    "effectiveRights": [  
        "Read",  
        "Delete",  
        "ChangeOwnership",  
        "ChangeVisibility",  
        "ViewPermissions",  
        "ViewRoles",  
        "Update",  
        "TakeOwnership"  
    ],  
    "properties": {  
        "fromSourceSystem": true,  
    "name": "Orders",  
    "dataSource": {  
        "sourceType": "SQL Server",  
            "objectType": "Table"  
    },  
    "dsl": {  
        "protocol": "tds",  
        "authentication": "windows",  
        "address": {  
            "server": "MyServer.contoso.com",  
            "database": "NORTHWND",  
            "schema": "dbo",  
            "object": "Orders"  
        }  
    },  
    "lastRegisteredBy": {  
        "upn": "user1@contoso.com",  
        "firstName": "User1FirstName",  
        "lastName": "User1LastName"  
    },  
        "containerId": "containers/3b2c00be-...-1f15367f54e4"  
    },  
    "annotations": {  
        "schema": {  
            "id": "https://e2255231-6dd3-1a0d-a6d8-7fc96dd780c2-mycatalog.api.azuredatacatalog.com/catalogs/MyCatalog/views/tables/042297b0-...-1be45ecd462a/schema",  
            "etag": "1234567892",  
            "timestamp": "2015-05-15T03:48:39.2425547",  
            "roles": [  
                {  
                    "role": "Contributor",  
                    "members": [  
        {  
                            "objectId": "00000000-0000-0000-0000-000000000201"  
                        }  
                    ]  
                }  
            ],  
            "effectiveRights": [  
                    "Read",  
                    "Delete",  
                    "ViewRoles",  
                    "Update"  
                ],  
            "properties": {  
                "fromSourceSystem": true,  
            "columns": [  
                {  
                    "name": "OrderID",  
                    "isNullable": false,  
                    "type": "int",  
                    "maxLength": 4,  
                    "precision": 10  
                },  
                {  
                    "name": "CustomerID",  
                    "isNullable": true,  
                    "type": "nchar",  
                    "maxLength": 10,  
                    "precision": 0  
                },  
                {  
                    "name": "EmployeeID",  
                    "isNullable": true,  
                    "type": "int",  
                    "maxLength": 4,  
                    "precision": 10  
                },  
                {  
                    "name": "OrderDate",  
                    "isNullable": true,  
                    "type": "datetime",  
                    "maxLength": 8,  
                    "precision": 23  
                }  
                ]  
        }  
        },  
    "experts": [  
        {  
                "id": "https://e2255231-6dd3-1a0d-a6d8-7fc96dd780c2-mycatalog.api.azuredatacatalog.com/catalogs/MyCatalog/views/tables/042297b0-...-1be45ecd462a/experts/22c3fa019b3945dc97143ebc3ad74cbf-1111fa019b3945dc97143ebc3ad74cbf",  
                "etag": "1234567893",  
                "timestamp": "2015-05-15T03:48:39.2425547",  
                "roles": [  
                    {  
                        "role": "Contributor",  
                        "members": [  
                            {  
                                "objectId": "22c3fa01-9b39-45dc-9714-3ebc3ad74cbf"  
                            }  
                        ]  
                    }  
                ],  
                "effectiveRights": [  
                    "Read",  
                    "Delete",  
                    "ViewRoles",  
                    "Update"  
                ],  
                "properties": {  
                    "fromSourceSystem": false,  
                    "key": "22c3fa019b3945dc97143ebc3ad74cbf-1111fa019b3945dc97143ebc3ad74cbf",  
                    "expert": {  
                        "upn": "expert1@contoso.com",  
                        "objectId": "1111fa019b3945dc97143ebc3ad74cbf"  
                    }  
                }  
        }  
    ]  
}  
}

Sağlanan arama terimlerine göre veri varlıkları üzerinde aramalar.

İstek

GET https://api.azuredatacatalog.com/catalogs/{catalog_name}/search/search?api-version={api-version}&searchTerms={search_terms}&facets={facet_terms}&startPage={start_page}&count={count}&view={data_source}  

Not

Bazı HTTP istemci uygulamaları, sunucudan bir 302'ye yanıt olarak istekleri otomatik olarak yeniden verebilir, ancak genellikle istekten Yetkilendirme üst bilgilerini kaldırır. ADC'ye istek göndermek için Yetkilendirme üst bilgisi gerektiğinden, ADC tarafından belirtilen yeniden yönlendirme konumuna bir istek yeniden verilirken Yetkilendirme üst bilgisinin hala sağlandığından emin olmanız gerekir. Aşağıda .NET HttpWebRequest nesnesini kullanarak bunu gösteren örnek kod verilmiştir.

Uri parametreleri

Ad Açıklama Veri Türü
Catalog_name Kataloğun adı veya varsayılan kataloğu kullanmak için "DefaultCatalog". Dize
api-sürümü API sürümü. Dize

Sorgu parametreleri

Ad Açıklama Veri Türü
searchTerms Gereklidir. Aranacak terimler. Dize
Yön -leriyle İsteğe bağlı Sonuçların model oluşturması için virgülle ayrılmış alan adları. Dize
Startpage Disk Belleği için kullanılan sonuçların isteğe bağlı Başlangıç Sayfası ve count parametresi. İzin verilen değerler 0'dan büyüktür; 0'dan küçük veya 0'a eşit bir değer geçirilirse, hata kodu 400 olan bir HTTP hatası döndürülür. Dize
count İsteğe Bağlı Tek sayfada istenen sonuç sayısı (Sayfalama). Varsayılan değer 10'dur. İzin verilen değerler 1 ile 100 (dahil) arasında bir aralıktadır. Bu aralıktan bir değer geçirilirse, hata kodu 400 olan bir HTTP hatası döndürülür. Arama sonuçlarının bir sonraki bölümünü almak için isteği yineleyin, ancak startPage'i 1 artırın. Tamsayı
görüntüle İsteğe Bağlı İstemcinin görmek istediği görünümü alır, şimdilik DataSource'ta desteklenen tek seçenek. Dize

GET örneği

https://api.azuredatacatalog.com/catalogs/DefaultCatalog/search/search?searchTerms=My_Server&count=10&startPage=1&api-version=2016-03-30

Üst bilgi

x-ms-client-request-id: 546f053a…a1612f3a3d69  
Authorization:  Bearer eXJ0eyAiOiJKV1QiLCJhbGciOi...  

Yanıt

Durum kodları

Kod Description
200 Tamam ögesini seçin. Arama sonucuyla başarılı bir işlem.

İçerik Türü

application/json

Üst bilgi

x-ms-request-id: 0ab2e798…088223257ad2  
Content-Length:  3926

Gövde

{  
"query": {  
    "id": "bd067219...4ba9a56e204b",  
    "searchTerms": "My_server",  
    "startIndex": 1,  
    "startPage": 1,  
    "count": 1,  
    "id": "bd067219...4ba9a56e204b",  
    "totalResults": 508,  
    "startIndex": 1,  
    "itemsPerPage": 1,  
    "results": [{  
    "updated": "0001-01-01T00:00:00",  
    "content": {  
          "properties": {  
            "fromSourceSystem": true,  
            "name": "MyTable",  
            "dsl": {  
              "protocol": "tds",  
              "authentication": "windows",  
              "address": {  
                "server": "My_SERVER",  
                "database": "my_DB",  
                "schema": "my_SCHEMA",  
                "object": "my_TABLE"  
              }  
            },  
            "dataSource": {  
              "sourceType": "SQL Server",  
              "objectType": "Table"  
            },  
            "lastRegisteredBy": {  
              "upn": "user1@contoso.com",  
              "firstName": "User1FirstName",  
              "lastName": "User1LastName"  
            },  
            "containerId": "https://e2255231-6dd3-1a0d-a6d8-7fc96dd780c2-mycatalog.api.azuredatacatalog.com/catalogs/MyCatalog/views/containers/a9f8a2e1-d826-7c0c-b186-c7f4334a6b4f"  
          },  
          "id": "https://e2255231-6dd3-1a0d-a6d8-7fc96dd780c2-mycatalog.api.azuredatacatalog.com/catalogs/MyCatalog/views/tables/08d91f0d-26a0-1e8e-ab3b-d463ac3e62cb",  
          "type": "Microsoft.DataSource.Table.1",  
          "timestamp": "2016-03-15T23:20:12.5423855",  
          "annotations": {  
            "schema": {  
              "properties": {  
                "fromSourceSystem": true,  
                "columns": [  
                  {  
                    "name": "ID",  
                    "type": "int",  
                    "maxLength": 4,  
                    "precision": 10,  
                    "isNullable": false  
                  },  
                  {  
                    "name": "Column2",  
                    "type": "nchar",  
                    "maxLength": 10,  
                    "precision": 0,  
                    "isNullable": true  
                  }  
                ]  
              },  
              "id": "https://e2255231-6dd3-1a0d-a6d8-7fc96dd780c2-mycatalog.api.azuredatacatalog.com/catalogs/MyCatalog/views/tables/08d91f0d-26a0-1e8e-ab3b-d463ac3e62cb/schema",  
              "type": "Microsoft.DataSource.Schema.1",  
              "timestamp": "2016-03-15T23:20:12.5423855",  
              "roles": [  
                {  
                  "role": "Contributor",  
                  "members": [  
                    {  
                      "objectId": "00000000-0000-0000-0000-000000000201"  
                    }  
                  ]  
                }  
              ],  
              "effectiveRights": [  
                "Read",  
                "Delete",  
                "ViewRoles",  
                "Update"  
              ]  
            }  
          },  
          "roles": [  
            {  
              "role": "Contributor",  
              "members": [  
                {  
                  "objectId": "00000000-0000-0000-0000-000000000201"  
                }  
              ]  
            }  
          ],  
          "effectiveRights": [  
            "Read",  
            "Delete",  
            "ChangeOwnership",  
            "ChangeVisibility",  
            "ViewPermissions",  
            "ViewRoles",  
            "Update",  
            "TakeOwnership"  
          ]  
        },  
    "hitProperties": [{  
        "fieldPath": "properties.dsl.address.server",  
        "highlightDetail": [{  
            "highlightedWords": [{  
                "word": "My_sERVER"  
            }],  
            "highlightedFragment": "My_sERVER"  
        }]  
    },  
    {  
        "fieldPath": "properties.dataSource.sourceType",  
        "highlightDetail": [{  
            "highlightedWords": [{  
                "word": "Server"  
            }],  
            "highlightedFragment": "SQL Server"  
        }]  
    },  
    {  
        "fieldPath": "properties.dsl.address.object",  
        "highlightDetail": [{  
            "highlightedWords": [{  
                "word": "my"  
            }],  
            "highlightedFragment": "my_TABLE"  
        }]  
    },  
    {  
        "fieldPath": "properties.dsl.address.database",  
        "highlightDetail": [{  
            "highlightedWords": [{  
                "word": "my"  
            }],  
            "highlightedFragment": "my_DB"  
        }]  
    },  
    {  
        "fieldPath": "properties.dsl.address.schema",  
        "highlightDetail": [{  
            "highlightedWords": [{  
                "word": "my"  
            }],  
            "highlightedFragment": "my_SCHEMA"  
        }]  
    }]  
}]  
}

Örnek

Bu örnekte, Azure AD erişim belirtecini alma ve Arama işlemi gerçekleştirme işlemleri gösterilmektedir.

NotKatalog adını bulmak için Azure Veri Kataloğu oturum açın ve Kullanıcı'yı seçin. Katalog adını görürsünüz.

using System;  
using System.Net;  
using Microsoft.IdentityModel.Clients.ActiveDirectory;  
using System.IO;  

...  

//To learn how to register a client app and get a Client ID,  
// see https://msdn.microsoft.com/library/azure/mt403303.aspx#clientID  
static string clientIDFromAzureAppRegistration = "{clientID}";  

static void Main(string[] args)  
{  
    //Note: This example uses the "DefaultCatalog" keyword to update the user's default catalog.  You may alternately  
    //specify the actual catalog name.  
    string catalogName = "DefaultCatalog";  

    //Search everything  
    string searchTerm = string.Empty;  

    string searchJson = Search(catalogName, searchTerm);  
    //Other examples "tags:=Sales", "upn:{username}"  

    Console.WriteLine(searchJson);  
}  

static AuthenticationResult AccessToken()  
{  
    //Get access token:  
    // To call a Data Catalog REST operation, create an instance of AuthenticationContext and call AcquireToken  
    // AuthenticationContext is part of the Active Directory Authentication Library NuGet package  
    // To install the Active Directory Authentication Library NuGet package in Visual Studio,  
    //  run "Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory" from the nuget Package Manager Console.  

    //Resource Uri for Data Catalog API  
    string resourceUri = "https://api.azuredatacatalog.com";  

    //To learn how to register a client app and get a Client ID, see https://msdn.microsoft.com/library/azure/mt403303.aspx#clientID    
    string clientId = clientIDFromAzureAppRegistration;  

    //A redirect uri gives AAD more details about the specific application that it will authenticate.  
    //Since a client app does not have an external service to redirect to, this Uri is the standard placeholder for a client app.  
    string redirectUri = "https://login.live.com/oauth20_desktop.srf";  

    // Create an instance of AuthenticationContext to acquire an Azure access token  
    // OAuth2 authority Uri  
    string authorityUri = "https://login.windows.net/common/oauth2/authorize";  
    AuthenticationContext authContext = new AuthenticationContext(authorityUri);  

    // Call AcquireToken to get an Azure token from Azure Active Directory token issuance endpoint  
    //  AcquireToken takes a Client Id that Azure AD creates when you register your client app.  
    return authContext.AcquireToken(resourceUri, clientId, new Uri(redirectUri), PromptBehavior.RefreshSession);  
}  

static string Search(string catalogName, string searchTerm)  
{  
    string responseContent = string.Empty;  

    //NOTE: To find the Catalog Name, sign into Azure Data Catalog, and choose User. You will see a list of Catalog names.            
    string fullUri =  
        string.Format("https://api.azuredatacatalog.com/catalogs/{0}/search/search?searchTerms={1}&count=10&api-version=2016-03-30", catalogName, searchTerm);  

    //Create a GET WebRequest  
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(fullUri);  
    request.Method = "GET";  

    try  
    {  
        //Get HttpWebResponse from GET request  
        using (HttpWebResponse httpResponse = SetRequestAndGetResponse(request))  
        {  
            //Get StreamReader that holds the response stream  
            using (StreamReader reader = new System.IO.StreamReader(httpResponse.GetResponseStream()))  
            {  
                responseContent = reader.ReadToEnd();  
            }  
        }  
    }  
    catch (WebException ex)  
    {  
        Console.WriteLine(ex.Message);  
        Console.WriteLine(ex.Status);  
        if (ex.Response != null)  
        {  
            // can use ex.Response.Status, .StatusDescription  
            if (ex.Response.ContentLength != 0)  
            {  
                using (var stream = ex.Response.GetResponseStream())  
                {  
                    using (var reader = new StreamReader(stream))  
                    {  
                        Console.WriteLine(reader.ReadToEnd());  
                    }  
                }  
            }  
        }  
        return null;  
    }  

    return responseContent;  
}  

static HttpWebResponse SetRequestAndGetResponse(HttpWebRequest request, string payload = null)  
{  
    while (true)  
    {  
        //To authorize the operation call, you need an access token which is part of the Authorization header  
        request.Headers.Add("Authorization", AccessToken().CreateAuthorizationHeader());  
        //Set to false to be able to intercept redirects  
        request.AllowAutoRedirect = false;  

        if (!string.IsNullOrEmpty(payload))  
        {  
            byte[] byteArray = Encoding.UTF8.GetBytes(payload);  
            request.ContentLength = byteArray.Length;  
            request.ContentType = "application/json";  
            //Write JSON byte[] into a Stream  
            request.GetRequestStream().Write(byteArray, 0, byteArray.Length);  
        }  
        else  
        {  
            request.ContentLength = 0;  
        }  

        HttpWebResponse response = request.GetResponse() as HttpWebResponse;  

        // Requests to **Azure Data Catalog (ADC)** may return an HTTP 302 response to indicate  
        // redirection to a different endpoint. In response to a 302, the caller must re-issue  
        // the request to the URL specified by the Location response header.    
        if (response.StatusCode == HttpStatusCode.Redirect)  
        {  
            string redirectedUrl = response.Headers["Location"];  
            HttpWebRequest nextRequest = WebRequest.Create(redirectedUrl) as HttpWebRequest;  
            nextRequest.Method = request.Method;  
            request = nextRequest;  
        }  
        else  
        {  
            return response;  
            break;  
        }  
    }  
}

Sil

Bir veri varlığını ve ekli tüm ek açıklamaları (varsa) siler.

İyimser eşzamanlılık denetimi için isteğe bağlı If-Match üst bilgisini destekler. Yalnızca W/"123456789" gibi zayıf biçim desteklenir.

İstek

DELETE https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}/{view_item_id}?api-version={api-version}  

Not

Bazı HTTP istemci uygulamaları, sunucudan bir 302'ye yanıt olarak istekleri otomatik olarak yeniden verebilir, ancak genellikle istekten Yetkilendirme üst bilgilerini ayırır. ADC'ye istekte bulunmak için Yetkilendirme üst bilgisi gerektiğinden, ADC tarafından belirtilen yeniden yönlendirme konumuna bir istek yeniden verilirken Yetkilendirme üst bilgisinin hala sağlandığından emin olmanız gerekir. Aşağıda .NET HttpWebRequest nesnesini kullanarak bunu gösteren örnek kod verilmiştir.

Uri parametreleri

Ad Açıklama Veri Türü
Catalog_name Kataloğun adı veya varsayılan kataloğu kullanmak için "DefaultCatalog". Dize
view_name Veri Varlığı Görünümünün adı. Dize
view_item_id Görünüm öğesinin kimliği. Dize
api-sürümü API sürümü. Dize

DELETE örneği

DELETE https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b0...1be45ecd462a?api-version=2016-03-30

Üst bilgi

x-ms-client-request-id: 59b68a46…46dc3ec8dcb8    
Authorization:  Bearer eXJ0eyAiOiJKV1QiLCJhbGciOi...    
If-Match: W/"123456789"  

Yanıt

Durum kodları

Kod Description
204 NoContent
NOT: Silme işlemi semantiği "varsa sil" şeklindedir, dolayısıyla varlık veya ek açıklama yoksa başarı durum kodu 204 (NoContent) döndürülür.
412 Önkoşul Başarısız oldu. ETag uyuşmazlığı nedeniyle istek iptal edildi.

İçerik Türü

application/json

Üst bilgi

x-ms-request-id: 664f86cf…5e512fa78e92  

Ek Açıklamayı Güncelleştirme

Ek açıklama Güncelleştirmeler.

Öğeler isteğe bağlı olarak iyimser eşzamanlılık denetimi sağlamak için ETag değerleri içerebilir.

İstek

PUT https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}/{view_item_id}/{nested_view_name}/{nested_non_singleton_view_item_id}?api-version={api-version} 
 
PUT https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}/{view_item_id}/{nested_view_name}?api-version={api-version}  

Not

Bazı HTTP istemci uygulamaları, sunucudan bir 302'ye yanıt olarak istekleri otomatik olarak yeniden verebilir, ancak genellikle istekten Yetkilendirme üst bilgilerini ayırır. ADC'ye istekte bulunmak için Yetkilendirme üst bilgisi gerektiğinden, ADC tarafından belirtilen yeniden yönlendirme konumuna bir istek yeniden verilirken Yetkilendirme üst bilgisinin hala sağlandığından emin olmanız gerekir. Aşağıda .NET HttpWebRequest nesnesini kullanarak bunu gösteren örnek kod verilmiştir.

Uri parametreleri

Ad Açıklama Veri Türü
Catalog_name Kataloğun adı veya varsayılan kataloğu kullanmak için "DefaultCatalog". Dize
view_name Veri Varlığı Görünümünün adı. Dize
view_item_id Görünüm öğesinin kimliği. Dize
nested_view_name İç içe görünümün adı. Dize
nested_non_singleton_view_item_id İç içe yerleştirilmiş tekil olmayan bir Görünüm öğesinin kimliği. Tekil olmayan bir görünüm için sağlanmalıdır. Dize
api-sürümü API sürümü. Dize

Tekil Belgeler görünümü için PUT örneği

PUT https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b0...1be45ecd462a/documentation?api-version=2016-03-30

Üst bilgi

Content-Type:   application/json; charset=utf-8    
x-ms-client-request-id:   059692ee-...-57490fcec42c    
Authorization:  Bearer eXJ0eyAiOiJKV1QiLCJhbGciOi...  

Gövde şeması

Body:  
    {  
        "fromSourceSystem": false,  
        "etag": "123456789",  
        "content": "<new documentation content>",  
        "mimetype": "text",  
    }  

Yanıt

Durum kodları

Kod Description
200 Tamam ögesini seçin. Mevcut bir ek açıklama güncelleştirildi.
412 Önkoşul Başarısız oldu. En az bir öğedeki ETag uyuşmazlığı nedeniyle istek iptal edildi.

İçerik Türü

application/json

Üst bilgi

x-ms-request-id: 3b8668da…1558d0f407c0  

Ek Açıklamayı Silme

Bir ek açıklamayı ve iç içe yerleştirilmiş tüm ek açıklamaları (varsa) siler.

İyimser eşzamanlılık denetimi için isteğe bağlı If-Match üst bilgisini destekler. Yalnızca W/"123456789" gibi zayıf biçim desteklenir.

İstek

DELETE https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}/{view_item_id}/{nested_view_name}/{nested_non_singleton_view_item_id}?api-version={api-version}  
	
DELETE https://api.azuredatacatalog.com/catalogs/{catalog_name}/views/{view_name}/{view_item_id}/{nested_view_name}?api-version={api-version}  

Not

Bazı HTTP istemci uygulamaları, sunucudan bir 302'ye yanıt olarak istekleri otomatik olarak yeniden verebilir, ancak genellikle istekten Yetkilendirme üst bilgilerini ayırır. ADC'ye istekte bulunmak için Yetkilendirme üst bilgisi gerektiğinden, ADC tarafından belirtilen yeniden yönlendirme konumuna bir istek yeniden verilirken Yetkilendirme üst bilgisinin hala sağlandığından emin olmanız gerekir. Aşağıda .NET HttpWebRequest nesnesini kullanarak bunu gösteren örnek kod verilmiştir.

Uri parametreleri

Ad Açıklama Veri Türü
Catalog_name Kataloğun adı veya varsayılan kataloğu kullanmak için "DefaultCatalog". Dize
view_name Veri Varlığı Görünümünün adı. Dize
view_item_id Görünüm öğesinin kimliği. Dize
nested_view_name İç içe görünümün adı. Dize
nested_non_singleton_view_item_id İç içe yerleştirilmiş tekil olmayan bir Görünüm öğesinin kimliği. Tekil olmayan görünüm için sağlanmalıdır. Dize
api-sürümü API sürümü. Dize

DELETE örneği

DELETE https://api.azuredatacatalog.com/catalogs/DefaultCatalog/views/tables/042297b0-c187-49cc-8f30-1be45ecd462a/experts/22c3fa019b3945dc97143ebc3ad74cbf-1111fa019b3945dc97143ebc3ad74cbf?api-version=2016-03-30  

Üst bilgi

x-ms-client-request-id:   c8da5f08…67b203d77b2d  
Authorization:  Bearer eXJ0eyAiOiJKV1QiLCJhbGciOi...  
If-Match: W/"123456789"  

Yanıt

Durum kodları

Kod Description
204 NoContent
412 Önkoşul Başarısız oldu. ETag uyuşmazlığı nedeniyle istek iptal edildi.

İçerik Türü

application/json

Üst bilgi

x-ms-request-id: 276b9dc4…e5f7017805c