Di Merchant API, Anda dapat menggunakan wilayah geografis sebagai target untuk layanan yang terkait dengan resource accounts.products.regionalInventories
. Anda dapat menentukan wilayah sebagai kumpulan kode pos atau, di
beberapa negara, menggunakan geotarget standar. Untuk mengetahui informasi selengkapnya, lihat Menyiapkan
wilayah.
Untuk membuat dan memperbarui wilayah, Anda dapat menggunakan metode berikut:
Mengambil wilayah
Untuk mengambil wilayah yang ditentukan di akun Merchant Center, gunakan metode
accounts.regions.get
.
Berikut contoh permintaan:
GET https://merchantapi.googleapis.com/accounts/v1/accounts/125222396/regions/234567?key=[YOUR_API_KEY]
Berikut adalah contoh respons dari panggilan yang berhasil:
HTTP/1.1 200
{
"name": "accounts/125222396/regions/234567",
"displayName": "Canada",
"postalCodeArea": {
"regionCode": "CA",
"postalCodes": [
{
"begin": "L6A"
}
]
}
Mencantumkan semua wilayah
Untuk mencantumkan wilayah di akun Merchant Center Anda, gunakan metode
accounts.regions.list
.
Berikut contoh permintaan:
GET https://merchantapi.googleapis.com/accounts/v1/accounts/125222396/regions?pageSize=100&key=[YOUR_API_KEY]
Berikut adalah contoh respons dari panggilan yang berhasil:
HTTP/1.1 200
{
"regions": [
{
"name": "accounts/125222396/regions/234567",
"displayName": "Canada",
"postalCodeArea": {
"regionCode": "CA",
"postalCodes": [
{
"begin": "L6A"
}
]
},
"regionalInventoryEligible": true,
"shippingEligible": true
},
{
"name": "accounts/125222396/regions/Inline region",
"displayName": "Inline region",
"postalCodeArea": {
"regionCode": "CA",
"postalCodes": [
{
"begin": "M7B"
}
]
},
"regionalInventoryEligible": false,
"shippingEligible": true
},
]
}
Menyisipkan wilayah
Untuk menyisipkan definisi wilayah di akun Merchant Center, gunakan metode
accounts.regions.create
. Menjalankan metode ini memerlukan akses administrator.
Berikut contoh permintaan:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/102959835/regions?regionId=987654&key=[YOUR_API_KEY]
{
"displayName": "TestRegion",
"name": "987654",
"postalCodeArea": {
"postalCodes": [
{
"begin": "98109"
}
],
"regionCode": "US"
}
}
Berikut adalah contoh respons dari panggilan yang berhasil:
{
"name": "accounts/102959835/regions/987654",
"displayName": "TestRegion",
"postalCodeArea": {
"regionCode": "US",
"postalCodes": [
{
"begin": "98109"
}
]
},
"regionalInventoryEligible": true,
"shippingEligible": true
}
Untuk membuat wilayah baru dengan AreaCode
:
Berikut contoh permintaan:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/102959835/regions?regionId=168888&key=[YOUR_API_KEY] HTTP/1.1
{
"displayName": "WA_test",
"name": "168888",
"geotargetArea": {
"geotargetCriteriaIds": [
20101
]
}
}
Berikut adalah contoh respons dari panggilan yang berhasil:
{
"name": "accounts/102959835/regions/168888",
"displayName": "WA_test",
"geotargetArea": {
"geotargetCriteriaIds": [
"20101"
]
},
"regionalInventoryEligible": true,
"shippingEligible": false
}
Untuk memperbarui displayName
dan GeoTargetCriteriaIds
untuk region yang dibuat:
Berikut contoh permintaan:
PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/102959835/regions/168888?updateMask=displayName%2CgeotargetArea&key=[YOUR_API_KEY] HTTP/1.1
{
"displayName": "BR_test",
"geotargetArea": {
"geotargetCriteriaIds": [
20100
]
}
}
Berikut adalah contoh respons dari panggilan yang berhasil:
HTTP/1.1 200
{
"name": "accounts/102959835/regions/168888",
"displayName": "BR_test",
"geotargetArea": {
"geotargetCriteriaIds": [
"20100"
]
},
"regionalInventoryEligible": true,
"shippingEligible": false
}
Memperbarui wilayah
Untuk memperbarui definisi wilayah di akun Merchant Center, gunakan metode
accounts.regions.patch
. Menjalankan metode ini memerlukan akses administrator.
Berikut contoh permintaan:
PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/102959835/regions/987654?updateMask=displayName%2CpostalCodeArea&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json
Content-Type: application/json
{
"displayName": "Test",
"postalCodeArea": {
"postalCodes": [
{
"begin": "98108"
}
],
"regionCode": "US"
}
}
Berikut adalah contoh respons dari panggilan yang berhasil:
{
"name": "accounts/102959835/regions/987654",
"displayName": "Test",
"postalCodeArea": {
"regionCode": "US",
"postalCodes": [
{
"begin": "98108"
}
]
},
"regionalInventoryEligible": true,
"shippingEligible": true
}
Menghapus wilayah
Untuk menghapus definisi wilayah dari akun Merchant Center Anda, gunakan metode
accounts.regions.delete
. Menjalankan metode ini memerlukan akses administrator.
Berikut contoh permintaan:
DELETE https://merchantapi.googleapis.com/accounts/v1/accounts/102959835/regions/987654?key=[YOUR_API_KEY] HTTP/1.1
Berikut adalah contoh respons dari panggilan yang berhasil:
HTTP/1.1 200
{}
Operasi batch
Jika Anda mengelola beberapa wilayah, Merchant API menyediakan endpoint batch yang memungkinkan Anda membuat, memperbarui, dan menghapus hingga 100 wilayah dalam satu panggilan. Untuk mengetahui informasi selengkapnya, lihat Mengelola pengelompokan wilayah.