Search code examples
eddystonegoogle-beacon-platform

Google Proximity API Returns 500 Internal Error on pageToken Query


I am trying to list the number of beacons registered with my OAuth key, but am only receiving 10 at a time. I am structuring my HTTP request like so:

https://proximitybeacon.googleapis.com/v1beta1/beacons

I have tried to set maxResults to be greater than the total number of beacons retrieved (?maxResults=20), but that always returns a 400 Bad Request error (maxResults is not known). When I try to use pageToken=[KNOWN NEXT PAGE TOKEN], I get a 500 internal error.

Without the ability to use either of these, I can't see past my first 10 beacons. Any help would be greatly appreciated!

EDIT: According to this document, it looks like these parameters are not available for the Proximity API. I'm not sure if that's correct, because that would mean that it's not possible to list any more than the first 10 returned beacons.


Solution

  • The correct way to get a subsequent page of results is to use the pageToken parameter as you describe. While I believe I have seen this work before, I have verified that the API is currently returning a 500 error for this. (See my test results below.) It appears that this is a server-side problem.

    curl 'https://proximitybeacon.googleapis.com/v1beta1/beacons?pageSize=3' -H 'Authorization: Bearer MY_SECRET_OAUTH_TOKEN_HERE'
    {
      "beacons": [
        {
          ...
        },
        {
          ...
        },
        {
          ...
        }
      ],
      "nextPageToken": "Civ55nT/+//+zN7Pzs/Nz8zPy8/Kz8nPyM/Hz8bPns+dz5zPm8+ayMmdnf/+EAMhko+M85V85JMx00LwZ+bdJe8xuNeGz7eSTJAxP86ZtGulO0o5AQAEAIsZAABQAFoLCcck85hsjQ0JEAE",
      "totalCount": "5"
    }
    
    $ curl 'https://proximitybeacon.googleapis.com/v1beta1/beacons?pageSize=3&pageToken=Civ55nT/+//+zN7Pzs/Nz8zPy8/Kz8nPyM/Hz8bPns+dz5zPm8+ayMmdnf/+EAMhko+M85V85JMx00LwZ+bdJe8xuNeGz7eSTJAxP86ZtGulO0o5AQAEAIsZAABQAFoLCcck85hsjQ0JEAE' -H 'Authorization: Bearer MY_SECRET_OAUTH_TOKEN_HERE'
    {
      "error": {
        "code": 500,
        "message": "Internal error encountered.",
        "status": "INTERNAL"
      }
    }
    

    ```