Import DID Mappings to an Inbound Route
Imports DID mappings into an inbound route from a CSV or XLSX file. The file is parsed synchronously and validated row by row. The parsed rows are returned as a preview and are not saved until the inbound route is saved.
Request URL
POST {base_url}/uc-cconfig/api/v1/inbound-routes/{id}/did-mappings/import
Request parameters
- Headers
-
Parameter Required Type Description Authorization Yes String The access token used for authentication. Format: Bearer
{access_token}.x-tenant-code Yes String The tenant name. Note: You can obtain tenant name using the Query Tenants interface.
- Path parameters
-
Parameter Required Type Description id Yes String The ID of the inbound route. You can obtain the ID using the Search Inbound Routes interface. Set this parameter to 0when importing from the page of a new inbound route, in which case the route validation is skipped, the duplicate and capacity baselines are empty, and the preview rows are submitted with the Add an Inbound Route interface.
- Body parameters
-
Parameter Required Type Description resourceId Yes String The ID of the import file that has been uploaded to the resource service. The file must contain two columns: DID NumberandMatch to User.currentMappings No Array<DID_Mapping_Item> The full snapshot of the mappings currently displayed on the edit page. When this parameter is specified, duplicate and capacity checks are performed only against this set; when omitted, the saved mappings in the database are used as the baseline.
- DID_Mapping_Item
-
Parameter Required Type Description didId No String The ID of the DID record. You can obtain the ID using the Search DIDs interface. userId No String The ID of the target user. You can obtain the ID using the Get Available Users for Inbound Routes interface.
Response parameters
| Parameter | Type | Description |
|---|---|---|
| requestId | String | The unique ID of the request, which can be used to quickly locate the request. |
| code | String | The HTTP status code of the request.
|
| message | String | The status message of the request. |
| detailMessage | String | The detailed error information. When the request is successful, this parameter returns empty. |
| result | Object<Import_Result> | The import result. |
- Import_Result
-
Parameter Type Description rows Array<Imported_Row> The rows that are parsed successfully and enter the mapping list preview. failedRows Array<Failed_Row> The rows that fail the validation, with the failure reason and the original values.
- Imported_Row
-
Parameter Type Description rowNum Integer The row number in the file, starting from 2 because row 1 is the column header. didId String The ID of the matched DID in the DID range assigned to the tenant. didDisplay String The DID number in the default display format. userId String The ID of the matched user. extension String The extension number, returned as entered in the file. userName String The name of the matched user.
- Failed_Row
-
Parameter Type Description rowNum Integer The row number in the file. reason String The reason why the row fails:
DID_NOT_FOUND: No matching DID number is found.DID_MULTIPLE_MATCHES: Multiple DIDs match the number.USER_NOT_FOUND: The extension does not belong to a user in the current tenant.DUPLICATED_IN_FILE: The DID number is duplicated within the file.DUPLICATED_IN_LIST: The DID number is duplicated with the current mapping list.LIMIT_EXCEEDED: The row exceeds the maximum number of mappings allowed.INVALID_FORMAT: A field has an invalid format, such as a DID number longer than 31 characters or containing invalid characters.
rawDid String The DID number as entered in the file. rawUser String The extension as entered in the file.
Example
Request example
POST /uc-cconfig/api/v1/inbound-routes/366500156627767296/did-mappings/import HTTP/1.1
Host: api.cn.novoone.com
Authorization: Bearer eyJraWQiOiJjbi0wLWtleS0xIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJkaXN0cmlidXRvcmV4YW1wbGVAb3V0bG9vay5jb20iLCJhcHBfa2V5Ijoic2xOdnQzaHc1NXB2Vm5HRlNhR2ZOVTNmMWxYQ3lpa08iLCJncmFudF90eXBlIjoib3BlbmFwaSIsImNsaWVudF9leHQiOnsiZGVzY3JpcHRpb24iOiLnrKzkuInmlrnlkIjkvZzkvJnkvLTlupTnlKgiLCJwYXJ0bmVyIjoi56S65L6L5ZCI5L2c5LyZ5Ly0In0sImNsaWVudF90eXBlIjoib3BlbmFwaSIsImV4cCI6MTc5MzYzNzIxOSwiaWF0IjoxNzkzNjE1NjE5LCJqdGkiOiJiNWUzYTNmZi1mN2RmLTRmYjgtOWQ0Zi04NzUzNmU2OGUwZGQiLCJjbGllbnRfaWQiOiJub3ZvLW9wZW4tcGxhdGZvcm0iLCJ1c2VyX2V4dCI6eyJyb2xlSWRzIjpbM10sInN0eXBlIjoiQURNSU4iLCJ0ZW5hbnRDb2RlIjpudWxsLCJ0eXBlIjoiUF9BQ0NPVU5UIiwidXNlcklkIjozMDc2OTEzNjQ0OTE1OTk4NzIwLCJlbWFpbCI6ImRpc3RyaWJ1dG9yZXhhbXBsZUBvdXRsb29rLmNvbSIsInVzZXJuYW1lIjoiZGlzdHJpYnV0b3JleGFtcGxlQG91dGxvb2suY29tIiwidWNJZCI6MzA3NjkxMzY0NDg5MDgzMjg5Nn19.gVc8o7tevTHP2Ytwby78ZmEX3dcQIMOd9ADhGwNKwVlvXIQ2_TzP-g-rGu0T8rtT5dyZ_jvXErog5J-2RVXOzR9wE9TojkI8u1fDW8YujdsUZ-0nWJvm9JgtqxgoHpztOCWrxs8vQB1LdTWFLGb2ju7mFad3_9n7MIys13LqoLHVmgUl92oagEr2yHEi3fQPOfAbhQiQDxHNqPTtqV7eAIIHIEu8YZvHWaOeAkGl1sFO_bLe8k0P41MPM2ejTGrxJQ5XQ3dyRNf3gH5KykhAUOmvZV9gxgtXIFYzkAQiRGFBVFVmOliG9wBtHIV1xLroD8pLorXnvc6Ea4fvknWGMg
x-tenant-code: jint
Content-Type: application/json
{
"resourceId": "2117203920636051457"
}
The uploaded file contains a header row and six data rows: 612 34 56 00,1000, 612 34 56 01,1001, 364 726 328,1002, 612 34 56 00,1002, 612 34 56 99,1003, and 612 34 56 02,9999. The response returns the validation result of each row.
Response example
HTTP/1.1 200 OK { "requestId": "4a6d2c1ec1a63e84f79751382946db7c", "code": "200", "message": "SUCCESS", "detailMessage": "", "result": { "rows": [ { "rowNum": 2, "didId": "349095413464047616", "didDisplay": "612 34 56 00", "userId": "338136731335409664", "extension": "1000", "userName": "Leo Ball" }, { "rowNum": 3, "didId": "349095413464047617", "didDisplay": "612 34 56 01", "userId": "342552093490561024", "extension": "1001", "userName": "Terrell Smith" }, { "rowNum": 4, "didId": "367178921942994944", "didDisplay": "364 726 328", "userId": "338855950145581056", "extension": "1002", "userName": "Philip Huff" } ], "failedRows": [ { "rowNum": 5, "reason": "DUPLICATED_IN_FILE", "rawDid": "612 34 56 00", "rawUser": "1002" }, { "rowNum": 6, "reason": "DID_NOT_FOUND", "rawDid": "612 34 56 99", "rawUser": "1003" }, { "rowNum": 7, "reason": "USER_NOT_FOUND", "rawDid": "612 34 56 02", "rawUser": "9999" } ] } }
The rows returned in rows are a preview and are not saved. The mappings are persisted only when the inbound route is saved.