Data Source Mapping API
Go Up to Data Source API
This part of the Team Server API lets you work with the mappings between data sources and models.
Contents
- 1 GET v1/datasourcemappings
- 2 GET v1/datasources/<datasource id>/datasourcemappings
- 3 GET v1/models/<model id>/datasourcemappings
- 4 GET v1/datasourcemappings/<id>
- 5 POST v1/datasourcemappings
- 6 PUT v1/datasourcemappings/<id>
- 7 DELETE v1/datasourcemappings/<id>
- 8 Data Source Mapping Fields
- 9 Error Index
- 10 Example Response
- 11 See Also
GET v1/datasourcemappings
Obtains a list of data source mappings.
GET v1/datasources/<datasource id>/datasourcemappings
Obtains a list of data source mappings of the data source with the specified ID.
If successful, the response from the server provides a list of models with details about each one of them.
GET v1/models/<model id>/datasourcemappings
Obtains a list of data source mappings of the model with the specified ID.
If successful, the response from the server provides a list of models with details about each one of them.
GET v1/datasourcemappings/<id>
Obtains information about the data source mapping with the specified ID.
POST v1/datasourcemappings
Creates a data source mapping. Your request must provide the following fields:
- model
- Note: You only need to specify the ID of the model. For example:
{ "id": "3" }
- Note: You only need to specify the ID of the model. For example:
- datasource
- Note: You only need to specify the ID of the datasource. For example:
{ "id": "15" }
- Note: You only need to specify the ID of the datasource. For example:
- rank (optional)
- catalog (optional)
- Note: You only need to specify either the ID or the name of the catalog. For example:
{ "name": "Northwind" }
- Note: You only need to specify either the ID or the name of the catalog. For example:
- owner (optional)
- Note: You only need to specify either the ID or the name of the owner. For example:
{ "name": "jane" }
- Note: You only need to specify either the ID or the name of the owner. For example:
If successful, the response from the server provides all the details about your new data source mapping.
PUT v1/datasourcemappings/<id>
Updates the information of a data source mapping. Your request can provide any combination of the following fields:
- model
- Note: You only need to specify the ID of the model. For example:
{ "id": "3" }
- Note: You only need to specify the ID of the model. For example:
- datasource
- Note: You only need to specify the ID of the datasource. For example:
{ "id": "15" }
- Note: You only need to specify the ID of the datasource. For example:
- rank
- catalog
- Note: You only need to specify either the ID or the name of the catalog. For example:
{ "name": "Northwind" }
- Note: You only need to specify either the ID or the name of the catalog. For example:
- owner
- Note: You only need to specify either the ID or the name of the owner. For example:
{ "name": "jane" }
- Note: You only need to specify either the ID or the name of the owner. For example:
If successful, the response from the server provides all the details about your modified data source mapping.
DELETE v1/datasourcemappings/<id>
Deletes the data source mapping with the specified ID. If successful, the response is {"message":"OK","status":"200"}
.
Data Source Mapping Fields
Data source mapping resources in Data Source Mapping API requests and responses may include any combination of the following fields:
Item | Example | Description |
---|---|---|
|
|
An integer that uniquely identifies the data source mapping. |
|
|
The model that the data source mapping maps to a data source. This entry provides the following fields:
See the Model API for more information. |
|
|
The model that the data source mapping maps to a data source. This entry provides the following fields:
In addition to these fields, data source entries provide additional DBMS-specific fields. See the Data Source API for more information. |
|
|
The priority of this data source mapping in relation to other data source mapping that associate the same model and data source. In the list of data source mappings that you can access on the Related Data Sources or Related ER Models subpages, when there is more than one data source mapping that associates the same model and data source, data source mappings with a lower rank (higher priority) are displayed first. Two data source mappings that associate the same model and data source cannot have the same rank value. When you add or modify a data source mapping using an existing value, Team Server increases the rank of any existing data source mapping with a rank equal or lower than the conflicting new rank value, so that all rank values are different. For example, if a data source mapping A has rank 1 and you add a new data source mapping B with rank 1, the rank of the data source mapping A is automatically changed to 2. |
|
|
The catalog that contains the data source mapping. This entry provides the following fields:
|
|
|
The owner of the data source mapping. This entry provides the following fields:
|
|
|
The date when the data source mapping was created, in Unix time (seconds since 1970). |
|
|
Path relative to the Team Server root API URL that points to the entry of the data source mapping resource. For example, if the Team Server root API URL is http://teamserver.example.com/api , the example value here determines that you can access the data source mapping resource at http://teamserver.example.com/api/v1/datasourcemappings/27 . |
|
|
Path relative to the Team Server root URL that points to the page of the data source mapping. |
|
|
The type of the resource. Its value is always "DatasourceMapping" for data source mapping resources. |
Error Index
The following are some errors that you may find in API responses when working with the Data Source Mapping API:
HTTP Status Code | Response | Description |
---|---|---|
404 |
{
"message":"model not found",
"status": 404
}
|
There is no ER model with the specified ID. You can use the Model API to find out which ER models there are. |
{
"message":"datasource not found",
"status": 404
}
|
There is no data source with the specified ID. You can use the Data Source API to find out which data sources there are. |
See also the API Error Index for API error responses that are not only found when working with the Data Source Mapping API.
Example Response
This is an example response from a GET v1/datasourcemappings call:
{
"metadata_": {
"limit": 25,
"totalCount": 3,
"offset": 0
},
"datasourcemappings": [
{
"id": 27,
"model": {
"diagramURL": "/v1/diagrams/2",
"securityproperties": [],
"link": "/object/view.spg?key=3",
"type": "Model",
"url": "/v1/models/3",
"id": 3,
"project": "Projects",
"style": "Relational",
"modelType": "logical",
"submodels": [
{
"id": "3044",
"description": "",
"link": "/object/view.spg?key=3044",
"name": "Human Resources",
"image": "/getDiagImage.spg?image=20bb2bac1386431787c3ecfd026d1578"
},
// …
],
"name": "Logical",
"diagramLink": "/object/view.spg?key=2",
"attachments": [],
"diagram": "Adventure Works.DM1",
"owners": [
"Production",
// …
],
"notation": "IE-Crows Feet",
"diagramId": 2
},
"rank": 1,
"catalog": {
"id": 21,
"name": "Northwind"
},
"createdAt": 1375260212,
"link": "Not available",
"owner": {
"id": 24,
"name": "admin"
},
"type": "DatasourceMapping",
"datasource": {
"databaseType": "InterBase",
"port": "1234",
"dialect": "",
"link": "/datasource/view.spg?key=15",
"hostname": "localhost",
"type": "Data Source",
"url": "/v1/datasources/15",
"id": 15,
"characterset": "",
"createdAt": 1375260001,
"description": "",
"name": "MyDataSource",
"path": "C:\\mydatabase.gdb",
"role": "",
"stewards": [
{
"id": "1",
"name": "admin",
"type": "person",
"url": "Not available"
}
]
},
"url": "/v1/datasourcemappings/27"
},
// …
]
}
This is from a GET v1/datasourcemappings/<id> call:
{
"datasourcemapping": {
"id": 27,
"model": {
"diagramURL": "/v1/diagrams/2",
"securityproperties": [],
"link": "/object/view.spg?key=3",
"type": "Model",
"url": "/v1/models/3",
"id": 3,
"project": "Projects",
"style": "Relational",
"modelType": "logical",
"submodels": [
{
"id": "3044",
"description": "",
"link": "/object/view.spg?key=3044",
"name": "Human Resources",
"image": "/getDiagImage.spg?image=20bb2bac1386431787c3ecfd026d1578"
},
// …
],
"name": "Logical",
"diagramLink": "/object/view.spg?key=2",
"attachments": [],
"diagram": "Adventure Works.DM1",
"owners": [
"Sales",
// …
],
"notation": "IE-Crows Feet",
"diagramId": 2
},
"rank": 1,
"catalog": {
"id": 21,
"name": "Northwind"
},
"createdAt": 1375260212,
"link": "Not available",
"owner": {
"id": 24,
"name": "admin"
},
"type": "DatasourceMapping",
"datasource": {
"databaseType": "InterBase",
"port": "1234",
"dialect": "",
"link": "/datasource/view.spg?key=15",
"hostname": "localhost",
"type": "Data Source",
"url": "/v1/datasources/15",
"id": 15,
"characterset": "",
"createdAt": 1375260001,
"description": "",
"name": "MyDataSource",
"path": "C:\\mydatabase.gdb",
"role": "",
"stewards": [
{
"id": "1",
"name": "admin",
"type": "person",
"url": "Not available"
}
]
},
"url": "/v1/datasourcemappings/27"
}
}