Git Product home page Git Product logo

google-my-business-samples's Introduction

Google My Business API Samples

drawing

This repository contains samples, demos and tools relating to the latest Google My Business API. Click here for v4 samples instead.

Samples are provided in a number of different programming languages broken out by directory.

For support, take a look at the support options available in the devsite

google-my-business-samples's People

Contributors

aswinthomas avatar brdaugherty avatar fblascogarma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-my-business-samples's Issues

Node and Golang support

Are there any plans to support Node and Go languages? I know that we can use REST but would be more convenient to use official provided libraries.

MyBusiness APIs without user prompt

Is there a possible way with which the libraries can be instantiated without a user prompt? We need to run the service in the background without user intervention. Thanks.

Fetch products from the API

Hi,
Is it possible to fetch products from a location using the GMB API in any way? I researched a lot and didn't find any useful information about it. I need those products that are shown in the "products tab".

Thanks.

Get Lodging Data is impossible

Hi, I'm trying to retrieve lodging data for multiple locations but the API seems not working.

I got the same error 400 for each location: Please check the value of Location.location_state.can_operate_lodging_data before fetching or updating Lodging data."

I'm using the API's V1 version, calling the getGoogleUpdated or getLodging methods without any result.

This is the actual call:

business_lodging = get_google_api_interface(
        credentials,
        "mybusinessbusinessinformation",
        "v1",
        'https://mybusinesslodging.googleapis.com/$discovery/rest?version=v1'
    )
    
location_lodging = business_lodging.locations().lodging().getGoogleUpdated(
                name="locations/XXXX/lodging",
                readMask=read_mask
            ).execute()

The problem is that the field Location.location_state.can_operate_lodging_data is moved under metadata in the V1 location and at the same time it's an output-only field that is always null. Also, adding lodging information from Google's UI doesn't change the value of that field.

Can't list products in the dashboard product menu creating products vie API

Here is the code below for creating products I use. If I created product this way that would be found to the Posts menu but not in the Products menu. Furthermore, if I created an event post that would be found in the Dashboard > Posts and then Events tab. Please let me know why this is happening. Thanks in advance.

    $lowerPrice = new Google_Service_MyBusiness_Money;
    $lowerPrice->setCurrencyCode($currency);
    $lowerPrice->setUnits($lowPrice);

    $upperPrice = new Google_Service_MyBusiness_Money;
    $upperPrice->setCurrencyCode($currency);
    $upperPrice->setUnits($highPrice);

    // Prepares local product post
    $localPostProduct = new Google_Service_MyBusiness_LocalPostProduct;
    $localPostProduct->setLowerPrice($lowerPrice);
    $localPostProduct->setUpperPrice($upperPrice);
    $localPostProduct->setProductName($title);

    // Prepares local post
    $localPost = new Google_Service_MyBusiness_LocalPost;
    $localPost->setProduct($localPostProduct);
    $localPost->setSummary($summary);
    $localPost->setMedia($media);

    $localPosts = $this->myBusiness->accounts_locations_localPosts;
    return $localPosts->create($parent, $localPost);

Can you show me php sample?

Hello, sir.
Could you please show google-my-business-sample using PHP?
It would be a great help for me and others.
Regards

Sample for MyBusinessAccountManagement.Builder usage

Could you add a sample showing how to use MyBusinessAccountManagement.Builder?

Following the pattern for the MyBusiness lib, I'm currently using

new MyBusinessAccountManagement.Builder(transport,
            JSON_FACTORY,
            credential)
            .setApplicationName(APPLICATION_NAME)
            .build()

but I'm getting a

java.lang.NoSuchMethodError: com.google.api.client.http.HttpTransport.isMtls()Z

error.

New Examples Repo.

So, I know this repo isn't getting updated and there's not a lot of help for GMB API people, so I've created a load of PHP examples over on my own repo here:
https://github.com/IORoot/examples__google-my-business

Currently will show you how to:

  • List account
  • List locations
  • List Local Posts
  • List Media Items
  • Upload Media
  • Create single local post.

Hopefully it should help some folks to get started. I'm currently creating my own project and needed to figure a load of stuff out, soI'll be adding to it in the future too.

[Upload Media API] Cannot upload photo from bytes.

Recently I use the upload API from bytes(follow this API Docs), but I failed to upload the photo. Here is my code:

const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", `Bearer ${accessToken}`);
const requestOptions = {
 method: 'POST',
 headers: myHeaders,
 redirect: 'follow'
};
fetch("https://mybusiness.googleapis.com/v4/accounts/*******/locations/******/media:startUpload", requestOptions)
 .then(res => res.json()) // here I got correct format response like this {  resourceName: '******'  }
 .then(res => {
     const myHeaders = new Headers();
     myHeaders.append("Authorization", `Bearer ${accessToken}`);
     myHeaders.append("Content-Type", "image/jpeg");
     const file = "<file contents accessed by input element event listener.>";
     const requestOptions = {
         method: 'POST',
         headers: myHeaders,
         body: file,
         redirect: 'follow'
     };
     return fetch(`https://mybusiness.googleapis.com/upload/v1/media/${res.resourceName}?upload_type=media`, 
       requestOptions)
      .then(result => {
        console.log(result)  // got nothing but empty string, status code is 200.
        return res;
      }) 
 })
 .then(res => {
       const myHeaders = new Headers();
       myHeaders.append("Content-Type", "application/json");
       const raw = JSON.stringify({"mediaFormat":"PHOTO","locationAssociation":{"category":"ADDITIONAL"},"dataRef":{"resourceName":`${res.resourceName}`}});
      myHeaders.append("Content-Type", "application/json");
      const requestOptions = {
         method: 'POST',
         headers: myHeaders,
         body: raw,
         redirect: 'follow'
      };
       fetch("https://mybusiness.googleapis.com/v4/accounts/****/locations/****/media", requestOptions)
         .then(response => response.json())
         .then(result => console.log(result))
         .catch(error => console.log('error', error));
 })

after the last request, I got the following error response:

{
    "error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
                "errorDetails": [
                    {
                        "code": 1000,
                        "message": "Fetching image failed."
                    }
                ]
            }
        ]
    }
}

Does something I did wrong?

Fetch Unverified listings

Hi,

Is there a way we can use to fetch unverified listings only like we do using account.location.list?

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.