Membuat dan memperbarui region

Panduan ini mewakili wilayah geografis yang dapat Anda gunakan sebagai target 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 region.

Untuk membuat dan memperbarui region, Anda dapat menggunakan metode berikut:

Mengambil wilayah

Untuk mengambil wilayah yang ditentukan di akun Merchant Center, gunakan metode accounts.regions.get.

Berikut adalah contoh permintaan:

GET https://merchantapi.googleapis.com/accounts/v1beta/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 region

Untuk mencantumkan wilayah di akun Merchant Center, gunakan metode accounts.regions.list.

Berikut adalah contoh permintaan:

GET https://merchantapi.googleapis.com/accounts/v1beta/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. Untuk menjalankan metode ini, Anda memerlukan akses administrator.

Berikut adalah contoh permintaan:

POST https://merchantapi.googleapis.com/accounts/v1beta/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 adalah contoh permintaan:

POST https://merchantapi.googleapis.com/accounts/v1beta/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 adalah contoh permintaan:

PATCH https://merchantapi.googleapis.com/accounts/v1beta/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. Untuk menjalankan metode ini, Anda memerlukan akses administrator.

Berikut adalah contoh permintaan:

PATCH https://merchantapi.googleapis.com/accounts/v1beta/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, gunakan metode accounts.regions.delete. Untuk menjalankan metode ini, Anda memerlukan akses administrator.

Berikut adalah contoh permintaan:

DELETE https://merchantapi.googleapis.com/accounts/v1beta/accounts/102959835/regions/987654?key=[YOUR_API_KEY] HTTP/1.1

Berikut adalah contoh respons dari panggilan yang berhasil:

HTTP/1.1 200
{}