--> --> --> -->

How to Update the Recipient’s Phone Number and Email

  1. Send a GET request to the URL https://app.edna.io/api/subscribers/get-by-address to get the unique identifier of the recipient specified in the id parameter.

Example of a GET request to get the unique identifier of the recipient:

curl --location --request GET 'https://app.edna.io/api/subscribers/get-by-address' \
--header 'x-api-key: ***' \
--header 'Content-Type: application/json' \
--data '{
    "address": "???",
    "type": "DEVICE_APP_ID"
}'

Response example:

{
    "id": 123456789,
    "blacklisted": false,
    "addresses": [
        {
            "id": "***",
            "address": "***",
            "type": "DEVICE_APP_ID",
            "info": {
                "@type": "DeviceAppInfo",
                "deviceUID": "***",
                "appPackageName": "***",
                "pushAppType": "ANDROID",
                "lastSeenAt": "***"
            }
        }
    ]
}
  1. Specify the unique identifier of the recipient from the id parameter and send a PATCH request with the required phone number or email address to the URL https://app.edna.io/api/subscribers/update.

Example of a PATCH request to update the phone number:

curl --location --request PATCH 'https://app.edna.io/api/subscribers/update' \
--header 'x-api-key: ***' \
--header 'Content-Type: application/json' \
--data '{
    "id": 123456789,
    "addresses": [
        {
            "address": "35000000000",
            "type": "PHONE"
        }
    ]
}'

Example of a PATCH request to update the phone number and email address:

curl --location --request PATCH 'https://app.edna.io/api/subscribers/update' \
--header 'x-api-key: ***' \
--header 'Content-Type: application/json' \
--data '{
    "id": 123456789,
    "addresses": [
        {
            "address": "35000000000",
            "type": "PHONE"
        },
		{
            "address": "???@mail.ru",
            "type": "EMAIL"
        }         
    ]
}' 
  1. Wait until you receive a response with the code 200.

If the request is unsuccessful, the phone number or email address provided is already in use by another recipient. Send a POST request to the URL https://app.edna.io/api/subscribers/delete-by-address to delete the data used, and repeat step 2 of the instructions above.

Example of a POST request to delete the phone number:

curl --location --request POST 'https://app.edna.io/api/subscribers/delete-by-address' \
--header 'x-api-key: ***' \
--header 'Content-Type: application/json' \
--data '{
    "address": "35000000000",
    "type": "PHONE"
}'
In this article