Directory API का इस्तेमाल करके, अपने ग्राहकों को प्रोग्राम के हिसाब से मैनेज किया जा सकता है. इस एपीआई में दिए गए तरीकों से, Google Workspace डोमेन की संपर्क जानकारी अपडेट की जा सकती है. साथ ही, अपने इंस्टेंस के लिए प्राइमरी डोमेन बदला जा सकता है.
किसी ग्राहक की जानकारी वापस पाना
किसी मौजूदा ग्राहक की जानकारी पाने के लिए, यहां दिया गया GET एचटीटीपी अनुरोध इस्तेमाल करें. साथ ही, अनुरोधों को अनुमति दें में बताया गया ऑथराइज़ेशन टोकन शामिल करें. customerKey, यूनीक customerId या my_customer हो सकता है. इससे मौजूदा ग्राहक के बारे में पता चलता है.
GET https://admin.googleapis.com/admin/directory/v1/customers/customerKey
अनुरोध पूरा होने पर, HTTP 200 स्टेटस कोड मिलता है. स्टेटस कोड के साथ-साथ, JSON रिस्पॉन्स में ग्राहक की यह जानकारी भी शामिल होती है:
{
"etag": "\"spqlTgq5LGeoin0BH1d0f4rpI98/LnbnRK_ZWu_omowg36CZgTKECrY\"",
"kind": "admin#directory#customer",
"alternateEmail": "yuri@example.com",
"id": "C03xgje4y",
"customerDomain": "example.com",
"postalAddress": {
"organizationName": "Example.com",
"countryCode": "US"
},
"customerCreationTime": "2015-10-21T20:42:35.224Z"
}
किसी मौजूदा ग्राहक की जानकारी अपडेट करना
किसी मौजूदा ग्राहक की जानकारी अपडेट करने के लिए, यहां दिया गया PUT अनुरोध इस्तेमाल करें. साथ ही, अनुरोधों को अनुमति देना लेख में बताया गया ऑथराइज़ेशन टोकन शामिल करें. customerKey, ग्राहक का यूनीक customerId या my_customer हो सकता है, ताकि मौजूदा ग्राहक की पहचान की जा सके.
PUT https://admin.googleapis.com/admin/directory/v1/customers/customerKey
अनुरोध पूरा होने पर, HTTP 200 स्टेटस कोड मिलता है. स्टेटस कोड के साथ-साथ, JSON रिस्पॉन्स में ग्राहक की नई अपडेट की गई जानकारी भी शामिल होती है:
{
"etag": "\"spqlTgq5LGeoin0BH1d0f4rpI98/LnbnRK_ZWu_omowg36CZgTKECrY\"",
"kind": "admin#directory#customer",
"alternateEmail": "yuri@example.com",
"id": "C03xgje4y",
"customerDomain": "example.com",
"postalAddress": {
"organizationName": "Example.com",
"phoneNumber": "+15558675309"
},
"customerCreationTime": "2015-10-21T20:42:35.224Z"
}
किसी ग्राहक के प्राइमरी डोमेन का नाम बदलना
किसी ग्राहक का प्राइमरी डोमेन बदलने के लिए, यहां दिया गया PUT अनुरोध इस्तेमाल करें. साथ ही, अनुरोधों को अनुमति देना में बताया गया अनुमति टोकन शामिल करें.
customerKey, यूनीक customerId या my_customer होना चाहिए.
PUT https://admin.googleapis.com/admin/directory/v1/customers/customerKey
JSON अनुरोध के मुख्य हिस्से में, customerDomain की नई वैल्यू शामिल होनी चाहिए:
{
"alternateEmail": "yuri@example.com",
"customerDomain": "example.com",
"language": "EN",
"postalAddress": {
"organizationName": "Example.com",
"phoneNumber": "+15558675309"
}
}
अनुरोध पूरा होने पर, HTTP 200 स्टेटस कोड मिलता है. स्टेटस कोड के साथ-साथ, JSON रिस्पॉन्स में ग्राहक की यह जानकारी भी शामिल होती है:
{
"etag": "\"spqlTgq5LGeoin0BH1d0f4rpI98/LnbnRK_ZWu_omowg36CZgTKECrY\"",
"kind": "admin#directory#customer",
"alternateEmail": "yuri@example.com",
"id": "C03xgje4y",
"customerDomain": "example.com",
"postalAddress": {
"organizationName": "Example.com",
"phoneNumber": "+15558675309"
},
"customerCreationTime": "2015-10-21T20:42:35.224Z"
}