Skip to content

Method: Location get does not return price in serviceItems array #2607

Open

Description

@syedMSohaib

Environment details

  • OS: MacOs
  • PHP version: 8.3.7

Steps to reproduce

  1. As mentioned in the documentation, i am trying to get data for a particular location and using below API, as the api returns the data, but in serviceItems price object is missing, As per https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations#Location.ServiceItem
    below should be the object
{
 "price": {
   object ([Money](https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations#Location.Money))
 },

 // Union field service_item_info can be only one of the following:
 "structuredServiceItem": {
   object ([StructuredServiceItem](https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations#Location.StructuredServiceItem))
 },
 "freeFormServiceItem": {
   object ([FreeFormServiceItem](https://developers.google.com/my-business/reference/businessinformation/rest/v1/accounts.locations#Location.FreeFormServiceItem))
 }
 // End of list of possible types for union field service_item_info.
}

but in my case price node is missing

Code example

$response = $client->authorize()->request('GET', 'https://mybusinessbusinessinformation.googleapis.com/v1/locations/xxxx?readMask=name,languageCode,storeCode,title,phoneNumbers,categories,storefrontAddress,websiteUri,regularHours,specialHours,serviceArea,labels,adWordsLocationExtensions,latlng,openInfo,metadata,profile,relationshipData,moreHours,serviceItems');

$response = json_decode($response->getBody());

I also tried using https://developers.google.com/oauthplayground, still same result price object is missing !

Thanks!

Activity

  1. changed the title [-]Method: Location get does not return price in serviceItems array #5288[/-] on Jul 3, 2024
  2. Hectorhammett commented on Jul 12, 2024

    @Hectorhammett
    Contributor

    Hello @syedMSohaib! Thanks for the message.

    Taking a look a the spec it mentions that price is optional:
    image

    Is the price set for the ServiceItem?

    Also, I recommend taking a look at the BusinessProfilePerformance service in the google-api-php-client-services repo here:
    https://github.com/googleapis/google-api-php-client-services/tree/main/src/BusinessProfilePerformance

    That class should let you access the API without writing a query from the client and use the service instead. Shouldn't fix this issue mind you, but should make writing code easier.

  3. syedMSohaib commented on Jul 13, 2024

    @syedMSohaib
    Author

    @Hectorhammett thanks for reaching back to me and for the suggestion.

    In original code, i am actually using the service instead, just giving you the query API for a context to know that these are the variable i am asking for from api.

    Is the price set for the ServiceItem?

    The admin of our GBP Location is updating the pricing directly from google GBP portal, but while fetching the API it does not return the prices node,

    Screenshot 2024-07-13 at 3 12 54 PM

    If you want i can give the complete API response, and parameters !,

    Will be eagerly waiting for your response, Thanks

  4. kaijaz123 commented on Jun 13, 2025

    @kaijaz123

    Hey, do you find a way around for this? I'm facing the same issues as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions