This topic describes how to call the GetPhoneNumberIdentificationUrl operation to obtain the URL for local phone number authentication.
View the API documentation
Before you call an API operation, we recommend that you read the documentation about the GetPhoneNumberIdentificationUrl operation to learn about the parameters and permissions that are required to call the API operation. For more information, see List of operations by function.
Call the API operation
In this example, Cell Phone Number Service SDK for Python is used to call this API operation. You can use SDKs for other programming languages in a similar way. For more information, see Cell Phone Number Service. You can use other methods to call operations based on your business requirements. For more information, see Call methods.
Install Python
Download and install Python 3. If you have installed Python, you can run the python --version
command to view the Python version.
Before you call the operation, you need to configure environment variables. This way, access credentials can be read from the environment variables. The environment variable names of the AccessKey ID and AccessKey secret are VMS_AK_ENV and VMS_SK_ENV. For more information, see Configure environment variables in Linux, macOS, and Windows.
Install dependencies
Run the following commands in sequence on your device to install dependencies:
pip3 install alibabacloud_credentials
pip install alibabacloud_dytnsapi20230101
pip3 install alibabacloud_tea_console
Download the sample code.
Access GetPhoneumberIdentificationUrl.
On the Parameters tab on the left, configure the required parameters. In this example, set Region to China (Hangzhou).
On the SDK Sample Code tab on the right, select Python and click Download Project to download the sample code package.
Decompress the package on your device and go to the alibabacloud_sample directory.
Run the code
Run the following command:
python sample.py
The following sample result is returned:
{
"headers":{
"access-control-allow-origin":"*",
"date":"Wed, 24 Apr 2024 09:27:47 GMT",
"content-length":"128",
"keep-alive":"timeout=25",
"x-acs-request-id":"7250E964-DFF7-5343-9CB6-4BA94AAD320F",
"connection":"keep-alive",
"content-type":"application/json;charset=utf-8",
"etag":"1Yd7WQjEOnVh24d2GHVjkIQ8",
"access-control-expose-headers":"*",
"x-acs-trace-id":"d553c17e7b941c8f9086ebe9cea4b5db"
},
"statusCode":200,
"body":{
"code":"OK",
"data":{
"carrierCode":"CTCC",
"verifyResult":1
},
"message":"OK",
"requestId":"7250E964-DFF7-5343-9CB6-4BA94AAD320F"
}
}