I am trying to register my beacon on OAuth2.0 Playground. When I am trying to register my beacon, it gives me following error:
{ "error": {
"status": "INVALID_ARGUMENT",
"message": "Invalid AdvertisedId id bytes length",
"code": 400 }
}
I am sending a POST
request to https://proximitybeacon.googleapis.com/v1beta1/beacons:register
with following application/json
body:
{
"advertisedId": {
"type": "EDDYSTONE",
"id": "ZWRkMWViXWFjMDRlNWRlZmEwNTdkMGU3ZDAwMmQ4YmM="
},
"status": "ACTIVE",
}
I am calculating advertiseID
of beacon by this:
InstanceID
: e61bdd5c2a9a
Namespace:
edd1ebfac04e5defa017
I am creating the advertiseId
by this method:
[1] Concatenate Namespace+Instance
. => edd1ebfac04e5defa017e61bdd5c2a9a
[2] Convert it to byte stream using following code:
byte[] message = "edd1ebfac04e5defa017e61bdd5c2a9a".getBytes(StandardCharsets.UTF_8);
[3] Then convert it to Base64
using following code:
String encoded = Base64.getEncoder().encodeToString(message);
Now encoded
is our advertisedId
which is ZWRkMWViXWFjMDRlNWRlZmEwNTdkMGU3ZDAwMmQ4YmM=
Can anyone help me?