Upload photos

You can upload photos to the Google My Business API using two methods:

Uploading from a URL

To upload photos to the Google My Business API using a URL, making the following call to Media.Create:

POST https://mybusiness.googleapis.com/v4/accounts/1234/locations/4567/media
{
  "mediaFormat": "PHOTO",
  "locationAssociation": {
    "category": "COVER"
  },
  "sourceUrl": “http://example.com/biz/image.jpg",
}

Uploading from bytes

Use the following steps to upload photos to the Google My Business API from bytes:

  1. To begin the upload, making the following call:

      POST https://mybusiness.googleapis.com/v4/accounts/1234/locations/4567/media:startUpload
      

    The response from the API returns a body containing a MediaItemDataRef:

      {
      "resourceName": "GoogleProvidedValue",
      }
  2. Use the resourceName returned by the call made in the previous step to upload the bytes:

    curl -X POST -T ~/Downloads/pictureToUpload.jpg  "http://mybusiness.googleapis.com/upload/v1/media/{GoogleProvidedValue}?upload_type=media"
  3. Call Media.Create using the resourceName returned in Step 1:

      POST https://mybusiness.googleapis.com/v4/accounts/1234/locations/4567/media
      {
        "mediaFormat": "PHOTO",
        "locationAssociation": {
          "category": "COVER"
        },
        "dataRef": {
          "resourceName": "GoogleProvidedValue"
        },
      }