Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
POST https://management.azure.com/providers/Microsoft.Billing/validateAddress?api-version=2020-05-01
URI Parameters
Name |
In |
Required |
Type |
Description |
api-version
|
query |
True
|
string
|
The version of the API to be used with the client request. The current version is 2020-05-01.
|
Request Body
Name |
Required |
Type |
Description |
addressLine1
|
True
|
string
|
Address line 1.
|
country
|
True
|
string
|
Country code uses ISO2, 2-digit format.
|
addressLine2
|
|
string
|
Address line 2.
|
addressLine3
|
|
string
|
Address line 3.
|
city
|
|
string
|
Address city.
|
companyName
|
|
string
|
Company name.
|
district
|
|
string
|
Address district.
|
email
|
|
string
|
Email address.
|
firstName
|
|
string
|
First name.
|
lastName
|
|
string
|
Last name.
|
middleName
|
|
string
|
Middle name.
|
phoneNumber
|
|
string
|
Phone number.
|
postalCode
|
|
string
|
Postal code.
|
region
|
|
string
|
Address region.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
AddressInvalid
Sample Request
POST https://management.azure.com/providers/Microsoft.Billing/validateAddress?api-version=2020-05-01
{
"addressLine1": "1 Test",
"city": "bellevue",
"region": "wa",
"postalCode": "12345",
"country": "us"
}
import com.azure.resourcemanager.billing.models.AddressDetails;
/** Samples for Address Validate. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressInvalid.json
*/
/**
* Sample code: AddressInvalid.
*
* @param manager Entry point to BillingManager.
*/
public static void addressInvalid(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.address()
.validateWithResponse(
new AddressDetails()
.withAddressLine1("1 Test")
.withCity("bellevue")
.withRegion("wa")
.withCountry("us")
.withPostalCode("fakeTokenPlaceholder"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.billing import BillingManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-billing
# USAGE
python address_invalid.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BillingManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.address.validate(
address={"addressLine1": "1 Test", "city": "bellevue", "country": "us", "postalCode": "12345", "region": "wa"},
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressInvalid.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbilling_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressInvalid.json
func ExampleAddressClient_Validate_addressInvalid() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbilling.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAddressClient().Validate(ctx, armbilling.AddressDetails{
AddressLine1: to.Ptr("1 Test"),
City: to.Ptr("bellevue"),
Country: to.Ptr("us"),
PostalCode: to.Ptr("12345"),
Region: to.Ptr("wa"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ValidateAddressResponse = armbilling.ValidateAddressResponse{
// Status: to.Ptr(armbilling.AddressValidationStatusInvalid),
// SuggestedAddresses: []*armbilling.AddressDetails{
// {
// AddressLine1: to.Ptr("1 Test Address"),
// City: to.Ptr("Bellevue"),
// Country: to.Ptr("US"),
// PostalCode: to.Ptr("98052"),
// Region: to.Ptr("WA"),
// },
// {
// AddressLine1: to.Ptr("1 Test Address"),
// City: to.Ptr("Bellevue"),
// Country: to.Ptr("US"),
// PostalCode: to.Ptr("12345-0000"),
// Region: to.Ptr("WA"),
// }},
// ValidationMessage: to.Ptr("Invalid address"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BillingManagementClient } = require("@azure/arm-billing");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
*
* @summary Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressInvalid.json
*/
async function addressInvalid() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const address = {
addressLine1: "1 Test",
city: "bellevue",
country: "us",
postalCode: "12345",
region: "wa",
};
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.address.validate(address);
console.log(result);
}
addressInvalid().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"status": "Invalid",
"suggestedAddresses": [
{
"country": "US",
"region": "WA",
"city": "Bellevue",
"addressLine1": "1 Test Address",
"postalCode": "98052"
},
{
"country": "US",
"region": "WA",
"city": "Bellevue",
"addressLine1": "1 Test Address",
"postalCode": "12345-0000"
}
],
"validationMessage": "Invalid address"
}
AddressValid
Sample Request
POST https://management.azure.com/providers/Microsoft.Billing/validateAddress?api-version=2020-05-01
{
"addressLine1": "1 Test Address",
"city": "bellevue",
"region": "wa",
"postalCode": "12345",
"country": "us"
}
import com.azure.resourcemanager.billing.models.AddressDetails;
/** Samples for Address Validate. */
public final class Main {
/*
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressValid.json
*/
/**
* Sample code: AddressValid.
*
* @param manager Entry point to BillingManager.
*/
public static void addressValid(com.azure.resourcemanager.billing.BillingManager manager) {
manager
.address()
.validateWithResponse(
new AddressDetails()
.withAddressLine1("1 Test Address")
.withCity("bellevue")
.withRegion("wa")
.withCountry("us")
.withPostalCode("fakeTokenPlaceholder"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.billing import BillingManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-billing
# USAGE
python address_valid.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BillingManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.address.validate(
address={
"addressLine1": "1 Test Address",
"city": "bellevue",
"country": "us",
"postalCode": "12345",
"region": "wa",
},
)
print(response)
# x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressValid.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbilling_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/billing/armbilling"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressValid.json
func ExampleAddressClient_Validate_addressValid() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbilling.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAddressClient().Validate(ctx, armbilling.AddressDetails{
AddressLine1: to.Ptr("1 Test Address"),
City: to.Ptr("bellevue"),
Country: to.Ptr("us"),
PostalCode: to.Ptr("12345"),
Region: to.Ptr("wa"),
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.ValidateAddressResponse = armbilling.ValidateAddressResponse{
// Status: to.Ptr(armbilling.AddressValidationStatusValid),
// SuggestedAddresses: []*armbilling.AddressDetails{
// {
// AddressLine1: to.Ptr("1 Test Address"),
// City: to.Ptr("Bellevue"),
// Country: to.Ptr("US"),
// PostalCode: to.Ptr("12345-0000"),
// Region: to.Ptr("WA"),
// }},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BillingManagementClient } = require("@azure/arm-billing");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
*
* @summary Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
* x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2020-05-01/examples/AddressValid.json
*/
async function addressValid() {
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const address = {
addressLine1: "1 Test Address",
city: "bellevue",
country: "us",
postalCode: "12345",
region: "wa",
};
const credential = new DefaultAzureCredential();
const client = new BillingManagementClient(credential, subscriptionId);
const result = await client.address.validate(address);
console.log(result);
}
addressValid().catch(console.error);
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"status": "Valid",
"suggestedAddresses": [
{
"country": "US",
"region": "WA",
"city": "Bellevue",
"addressLine1": "1 Test Address",
"postalCode": "12345-0000"
}
]
}
Definitions
AddressDetails
Address details.
Name |
Type |
Description |
addressLine1
|
string
|
Address line 1.
|
addressLine2
|
string
|
Address line 2.
|
addressLine3
|
string
|
Address line 3.
|
city
|
string
|
Address city.
|
companyName
|
string
|
Company name.
|
country
|
string
|
Country code uses ISO2, 2-digit format.
|
district
|
string
|
Address district.
|
email
|
string
|
Email address.
|
firstName
|
string
|
First name.
|
lastName
|
string
|
Last name.
|
middleName
|
string
|
Middle name.
|
phoneNumber
|
string
|
Phone number.
|
postalCode
|
string
|
Postal code.
|
region
|
string
|
Address region.
|
addressValidationStatus
status of the address validation.
Name |
Type |
Description |
Invalid
|
string
|
|
Valid
|
string
|
|
ErrorDetails
The details of the error.
Name |
Type |
Description |
code
|
string
|
Error code.
|
details
|
ErrorSubDetails[]
|
The sub details of the error.
|
message
|
string
|
Error message indicating why the operation failed.
|
target
|
string
|
The target of the particular error.
|
ErrorResponse
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.
Name |
Type |
Description |
error
|
ErrorDetails
|
The details of the error.
|
ErrorSubDetails
Name |
Type |
Description |
code
|
string
|
Error code.
|
message
|
string
|
Error message indicating why the operation failed.
|
target
|
string
|
The target of the particular error.
|
ValidateAddressResponse
Result of the address validation
Name |
Type |
Description |
status
|
addressValidationStatus
|
status of the address validation.
|
suggestedAddresses
|
AddressDetails[]
|
The list of suggested addresses.
|
validationMessage
|
string
|
Validation error message.
|