@ -1294,7 +1294,7 @@ On success, the HTTP status code in the response header is `200 OK` and the resp
The method accepts a CNAM record ID as a parameter which you can learn more about in the [API reference](https://developer.flowroute.com/api/cnams/v2.0/list-cnam-record-details/). In the example below, we query for approved CNAM records on your account and then extract the ID of the first record returned and retrieve the details of that specific CNAM record.
The method accepts a CNAM record ID as a parameter which you can learn more about in the [API reference](https://developer.flowroute.com/api/cnams/v2.0/list-cnam-record-details/). In the example below, we query for approved CNAM records on your account and then extract the ID of the first record returned and retrieve the details of that specific CNAM record.
##### Example Request
##### Example Request
```python
```
print("\n--List Approved CNAM Records")
print("\n--List Approved CNAM Records")
result = cnams_controller.list_cnams(is_approved=True)
result = cnams_controller.list_cnams(is_approved=True)
pprint.pprint(result)
pprint.pprint(result)
@ -1306,6 +1306,8 @@ if len(result['data']):
pprint.pprint(result)
pprint.pprint(result)
```
```
##### Example Response
##### Example Response
On success, the HTTP status code in the response header is `200 OK` and the response body contains a detailed cnam object in JSON format. For the sake of brevity, we will omit the response to the approved CNAM record query.
The method accepts a Caller ID value as a parameter which you can learn more about in the [API reference](https://developer.flowroute.com/api/cnams/v2.0/create-a-new-cnam-record/). In the example below, we reuse the `random_generator()` function to generate a four-character random string which we will concatenate with FR and assign as our CNAM value.
NOTE: Newly created CNAM records need to be approved first before they can be associated with your long code number.
```
#### associate_cnam(cnam_id, number_id)
The method accepts a CNAM record ID and a phone number as parameters which you can learn more about in the [API reference](https://developer.flowroute.com/api/cnams/v2.0/assign-cnam-record-to-phone-number/). In the following example, we will call `list_account_phone_numbers()` and associate the first number in the returned array with our previously assigned `cnam_id`.
print("Create some CNAM records and wait for approval before trying"
" to associate them with a DID")
else:
result = cnams_controller.associate_cnam(cnam_id, did_id)
pprint.pprint(result)
```
##### Example Response
On success, the HTTP status code in the response header is `202 Accepted` and the response body contains an attributes dictionary containing the `date_created` field and the assigned cnam object in JSON format. This request will fail if the CNAM you are trying to associate has not yet been approved.
```
--Associate a CNAM Record to a DID
{'data': {'attributes': {'date_created': 'Fri, 01 Jun 2018 00:17:52 GMT'},
'id': 17604,
'type': 'cnam'}}
```
#### unassociate_cnam(number_id)
The method accepts a phone number as a parameter which you can learn more about in the [API reference](https://developer.flowroute.com/api/cnams/v2.0/unassign-a-cnam-record-from-phone-number/). In the following example, we will disassociate the same phone number that we've used in `associate_cnam()`.
##### Example Request
```
print("\n--Unassociate a CNAM Record from a DID")
result = cnams_controller.unassociate_cnam(did_id)
pprint.pprint(result)
```
##### Example Response
On success, the HTTP status code in the response header is `202 Accepted` and the response body contains an attributes object with the date the CNAM was requested to be deleted, and the updated cnam object in JSON format.
```
--Unassociate a CNAM Record from a DID
{'data': {'attributes': {'date_created': 'Fri, 01 Jun 2018 00:17:52 GMT'},
'id': None,
'type': 'cnam'}}
```
#### remove_cnam(cnam_id)
The method accepts a CNAM record ID as a parameter which you can learn more about in the [API reference](https://developer.flowroute.com/api/cnams/v2.0/remove-cnam-record-from-account/). In the following example, we will be deleting our previously extracted `cnam_id` from the "List Approved CNAM Records" function call.
##### Example Request
```
print("\n--Remove a CNAM Record from your account")
result = cnams_controller.remove_cnam(cnam_id)
pprint.pprint(result)
```
##### Example Response
On success, the HTTP status code in the response header is `204 No Content` which means that the server successfully processed the request and is not returning any content.
```
--Remove a CNAM Record from your account
''
```
```
#### Errors
#### Errors
@ -1329,9 +1424,7 @@ On success, the HTTP status code in the response header is `200 OK` and the resp
In cases of method errors, the Python library raises an exception which includes an error message and the HTTP body that was received in the request.
In cases of method errors, the Python library raises an exception which includes an error message and the HTTP body that was received in the request.
##### Example Error
##### Example Error
```
` raise ErrorException('403 Forbidden – The server understood the request but refuses to authorize it.', _context) `
raise ErrorException('403 Forbidden – The server understood the request but refuses to authorize it.', _context)