Google Business Performance API 的新 API 方法可通过单个 API 请求提取多个 `DailyMetrics`。 请查看弃用时间表和相关说明,并从 v4 reportInsights API 方法迁移至 Google Business Profile Performance API。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eThe Google My Business API offers two methods for uploading media: directly from a URL or by uploading media from bytes.\u003c/p\u003e\n"],["\u003cp\u003eUploading from a URL involves a single API call to \u003ccode\u003eMedia.Create\u003c/code\u003e, specifying the media format, location association, and source URL.\u003c/p\u003e\n"],["\u003cp\u003eUploading from bytes is a three-step process: initiating the upload, uploading the bytes using the provided resource name, and finalizing the upload with a \u003ccode\u003eMedia.Create\u003c/code\u003e call referencing the resource name.\u003c/p\u003e\n"],["\u003cp\u003eWhile media for locations can be uploaded using both methods, media for local posts must be uploaded from a URL.\u003c/p\u003e\n"]]],[],null,["# Upload media\n\nYou can use the Google My Business API to upload media with the following two methods:\n\n- [Upload from a URL](#upload-from-url).\n- [Upload from bytes](#upload-from-bytes).\n\nUpload from a URL\n-----------------\n\nTo upload photos from a URL , make the following call to\n`Media.Create`. Use the relevant\n[category](/my-business/reference/rest/v4/accounts.locations.media#category)\nas needed. \n\n```text\nPOST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media\n{\n \"mediaFormat\": \"PHOTO\",\n \"locationAssociation\": {\n \"category\": \"COVER\"\n },\n \"sourceUrl\": “http://example.com/biz/image.jpg\",\n}\n```\n\nTo upload videos from a URL with the Google My Business API, make the following call to\n`Media.Create`: \n\n```text\nPOST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media\n{\n \"mediaFormat\": \"VIDEO\",\n \"locationAssociation\": {\n \"category\": \"ADDITIONAL\"\n },\n \"sourceUrl\": “http://example.com/biz/video.mp4\",\n}\n```\n\nUpload from bytes\n-----------------\n\nTo upload media from bytes with the Google My Business API, complete the following steps:\n| **Note:** There's only support to upload media from bytes for locations. To include media in a [local post](/my-business/reference/rest/v4/accounts.locations.localPosts), you must upload it from a URL.\n\n1. To begin the upload, make the following call:\n\n ```gdscript\n POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media:startUpload\n \n ```\n\n The response from the API returns a body that contains a `MediaItemDataRef`: \n\n ```text\n {\n \"resourceName\": \"GoogleProvidedValue\",\n }\n ```\n2. To upload the bytes, use the `resourceName` returned by the call made in the\n previous step. The following is an example where the media to be uploaded is a photo:\n\n ```gdscript\n curl -X POST -T ~/Downloads/pictureToUpload.jpg \"https://mybusiness.googleapis.com/upload/v1/media/{GoogleProvidedValue}?upload_type=media\"\n ```\n\n The following is an example if the media is a video: \n\n ```gdscript\n curl -X POST -T ~/Downloads/videoToUpload.mp4 \"https://mybusiness.googleapis.com/upload/v1/media/{GoogleProvidedValue}?upload_type=media\"\n ```\n3. Use the `resourceName` returned in Step 1 to call `Media.Create`.\n Use the relevant\n [mediaFormat](/my-business/reference/rest/v4/accounts.locations.media#mediaformat) and\n [category](/my-business/reference/rest/v4/accounts.locations.media#category).\n\n ```text\n POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media\n {\n \"mediaFormat\": \"PHOTO\",\n \"locationAssociation\": {\n \"category\": \"COVER\"\n },\n \"dataRef\": {\n \"resourceName\": \"GoogleProvidedValue\"\n },\n }\n ``` \n\n ```text\n POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/media\n {\n \"mediaFormat\": \"VIDEO\",\n \"locationAssociation\": {\n \"category\": \"ADDITIONAL\"\n },\n \"dataRef\": {\n \"resourceName\": \"GoogleProvidedValue\"\n },\n }\n ```"]]