Amazon SNS: How to get EndpointArn by token(registrationId) using amazon .net sdk?

前端 未结 2 1201
独厮守ぢ
独厮守ぢ 2021-02-05 09:40

I am trying to get EndpointArn by registration id using aws .net sdk. But i couldn\'t find a nice way to do it.

My first attempt was running CreatePlatformEndpointReque

2条回答
  •  情歌与酒
    2021-02-05 09:47

    What we did is store the endpoint ARN returned from CreatePlatformEndpoint in our application database. If we already have an endpoint ARN association for a given device registration id, we then call

    getEndpointAttributes passing in the endpoint arn from our database. If a result is returned, we then check if the endpoint is marked enabled and if not then call setEndpointAttributes and set key "Enabled" to "true".

    Unfortunately it doesn't look like Amazaon API offers a "findBy" method to look up by "CustomUserData" or "Token" and only has "list" methods that list all the existing endpoints which for most applications will not suffice if there are potentially thousands or millions of entries. It is almost as if API was written only to satisfy the Amazon Console UI use cases.

    Also, see Amazon docs for example API requests and responses

    http://docs.aws.amazon.com/sns/latest/api/API_GetEndpointAttributes.html http://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html

提交回复
热议问题