AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

My Business
3.3K members online now
3.3K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

Service Account - 404 Method not found

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

I'm trying to set up a service account for managing locations in Google Places using the Java client library. I have created a service account and am trying to use its credentials (in a JSON file) for sending a simple request to Google API.

 

public class Main {
    private static HttpTransport httpTransport;
    private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance();
    private static MyBusiness mybusiness;

    private static Credential authorize() throws Exception {
        InputStream resourceAsStream = Main.class.getResourceAsStream("credentials.json");

        GoogleCredential credential = GoogleCredential.fromStream(resourceAsStream);
        credential = credential.createScoped(Collections.singleton("https://www.googleapis.com/auth/plus.business.manage"));

        return credential;
    }

    public static void main(String[] args) throws Exception {
        httpTransport = GoogleNetHttpTransport.newTrustedTransport();

        Credential credential = authorize();

        mybusiness = new MyBusiness.Builder(httpTransport, JSON_FACTORY, credential).setApplicationName(<APP-NAME>).build();

        MyBusiness.Accounts.List accountsList = mybusiness.accounts().list();
        ListAccountsResponse response = accountsList.execute();
        List accounts = response.getAccounts();
    }
}

 

The server responds with an error:

 

{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "message" : "Method not found.",
    "reason" : "notFound"
  } ],
  "message" : "Method not found.",
  "status" : "NOT_FOUND"
}

 

The project is already whitelisted. The credentials were downloaded directly from the console. What could be the problem?

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Oleg G
January 2017

Re: Service Account - 404 Method not found

Google Employee
# 2
Google Employee

Hi @Oleg G

 

The 404 Method not found error typically happens when you are using a different Project ID from the one we whitelisted for your company to access the Google My Business API.

 

We’ll reach out to you privately on a separate thread for more details.

 

Thanks,

The Google My Business API team

View solution in original post

Marked as Best Answer.
Solution
Accepted by topic author Oleg G
January 2017

Re: Service Account - 404 Method not found

Google Employee
# 2
Google Employee

Hi @Oleg G

 

The 404 Method not found error typically happens when you are using a different Project ID from the one we whitelisted for your company to access the Google My Business API.

 

We’ll reach out to you privately on a separate thread for more details.

 

Thanks,

The Google My Business API team

Service Account - 404 Method not found

Follower ✭ ☆ ☆
# 3
Follower ✭ ☆ ☆

Hi @Shalini S,

 

Don't you think, reporting 403 would have been a better choice? Much more clear and self-explanatory?!

Service Account - 404 Method not found

Follower ✭ ☆ ☆
# 4
Follower ✭ ☆ ☆

Hi Shalini ,

 

I am also getting the same issue could you please help me out.

 

Thanks.

Re: Service Account - 404 Method not found

Google Employee
# 5
Google Employee

Hi @mKonnekt D,

 

The 404 Method not found error typically happens when you are using a different Project ID from the one we whitelisted for your company to access the Google My Business API.

 

Since you reported the same issue earlier as well in another thread, so we sent an email to your email address on this board regarding more details about your issue but haven’t gotten a response so far. Please reply directly to the email we sent.

 

Please also check your spam folder in case our emails were inadvertently filtered as spam.

 

Thanks,

The Google My Business API Team