אתם יכולים להשתמש ב-Directory API כדי לנהל את הלקוחות באופן פרוגרמטי. השיטות ב-API הזה מאפשרות לעדכן את הפרטים ליצירת קשר בדומיין שלכם ב-Google Workspace, וגם לשנות את הדומיין הראשי של המופע.
אחזור פרטי לקוח
כדי לאחזר לקוח קיים, משתמשים בבקשת ה-HTTP 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"
}