Tobias van de Ven
Tobias van de Ven

Reputation: 75

What could be causing HTTP error codes from the Homegraph API for REQUEST_SYNC?

We are using the Google Homegraph API to implement REQUEST_SYNC functionality for our Google Home project. This has appeared to be working fine in our testing, but recently we noticed that roughly a third of requests are responded to with HTTP codes other than 200.

We have seen the following codes:

429 is most likely due to some fault on our part, and we are currently looking into avoiding this. However, we are unable to determine what is causing the other codes.

In our limited ability to test, we have found that it appears to be limited to a specific user each time. Unlinking and re-linking our service seems to fix the issue (if only temporarily).

As a side note, the example here appears to contain invalid JSON, as there are quotation marks missing around agent_user_id. When testing a simple request, the omission or inclusion of the quotation marks didn't affect its success, but this may be confusing to readers.

Does anyone have advice to offer regarding these issues?

EDIT:

We are currently trying to reproduce the issues for an account by purposefully sending many REQUEST_SYNCs. This causes a number of 429 responses (and we've seen a single 500), but it has not yet caused future REQUEST_SYNCs to stop working entirely - previously we saw a user only ever receive 500 response codes until the service was relinked.

Unlinking a user did cause subsequent REQUEST_SYNCs to respond with 404, as expected. Is there a way to be notified when a user is no longer using our Google Home service so that we may stop sending them SYNC requests when they change something about their devices?

Upvotes: 1

Views: 452

Answers (1)

Nick Felker
Nick Felker

Reputation: 11978

A 400 may happen if there's an issue with your server sending data, such as if your agent_user_id has not been established in the Home Graph but you're trying to call something like REQUEST_SYNC.

A 500 may happen if the data you're returning has an issue, like if it doesn't match the schema or is otherwise not formatted correctly.

A 429 may happen if you're hitting the API too often.

A 404 may happen if the URL you're requesting doesn't exist, such as if the API key is invalid or the parameters you're sending are invalid.

If you can identify reproducible cases, it would be easier to find a fix.

Upvotes: 2

Related Questions