Eine neue Adresse erstellen

Dieses Codeschnipsel erstellt eine neue Adresse.

Beispiel

Ersetzen Sie die folgenden Variablen im Beispielcode:

SchlüsselBeschreibung
ADDRESS_NAME

The name of the address.

ADDRESS_LINE_1

The first line of the full address.

ADDRESS_LINE_2

The second line of the full address.

ADDRESS_CITY

The city where this address is located.

ADDRESS_REGION

The state or region of the address.

ADDRESS_TYPE

The type of address.

ADDRESS_LOCATION_TYPE

The address location type, as domestic or business.

ADDRESS_POSTAL_CODE

The postal code.

ADDRESS_COUNTRY

The two character country code in ISO 3166-1 alpha-2 format.

Schreiben Sie den Code

Fügen Sie Folgendes zu create-address.sh hinzu:

curl -X "POST" "https://api.nexmo.com/v1/addresses" \
     -H 'Content-Type: application/json' \
     -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
     -d $'{
           "address_name": "'$ADDRESS_NAME'",
           "address_line1": "'$ADDRESS_LINE_1'",
           "address_line2": "'$ADDRESS_LINE_2'",
           "city": "'$ADDRESS_CITY'",
           "region": "'$ADDRESS_REGION'",
           "type": "'$ADDRESS_TYPE'",
           "address_location_type": "'$ADDRESS_LOCATION_TYPE'",
           "postal_code": "'$ADDRESS_POSTAL_CODE'",
           "country": "'$ADDRESS_COUNTRY'"
     }'

Vollständige Quelle anzeigen

Führen Sie Ihren Code aus

Speichern Sie diese Datei auf Ihrem Rechner und führen Sie sie aus:

bash create-address.sh