# cm_client.DataContextsResourceApi

All URIs are relative to */api/v57*

Method | HTTP request | Description
------------- | ------------- | -------------
[**create_data_context**](DataContextsResourceApi.md#create_data_context) | **POST** /dataContexts | Create a datacontext.
[**delete_data_context**](DataContextsResourceApi.md#delete_data_context) | **DELETE** /dataContexts/{dataContextName} | Delete a datacontext.
[**read_data_context**](DataContextsResourceApi.md#read_data_context) | **GET** /dataContexts/{dataContextName} | Reads information about a datacontext.
[**read_data_contexts**](DataContextsResourceApi.md#read_data_contexts) | **GET** /dataContexts | Get all the datacontexts.
[**update_data_context**](DataContextsResourceApi.md#update_data_context) | **PUT** /dataContexts | Update a datacontext.

<a name="create_data_context" id="create_data_context"></a>
# **create_data_context**
> ApiDataContext create_data_context(body=body)

Create a datacontext.

Create a datacontext. Following are are required fields of ApiDataContext: name, displayName, services.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.DataContextsResourceApi(cm_client.ApiClient(configuration))
body = cm_client.ApiDataContext() # ApiDataContext | DataContext to be created. (optional)

try:
    # Create a datacontext.
    api_response = api_instance.create_data_context(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataContextsResourceApi->create_data_context: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**ApiDataContext**](ApiDataContext.md)| DataContext to be created. | [optional] 

### Return type

[**ApiDataContext**](ApiDataContext.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="delete_data_context" id="delete_data_context"></a>
# **delete_data_context**
> ApiDataContext delete_data_context(data_context_name)

Delete a datacontext.

Delete a datacontext.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.DataContextsResourceApi(cm_client.ApiClient(configuration))
data_context_name = 'data_context_name_example' # str | Name of the datacontext.

try:
    # Delete a datacontext.
    api_response = api_instance.delete_data_context(data_context_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataContextsResourceApi->delete_data_context: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **data_context_name** | **str**| Name of the datacontext. | 

### Return type

[**ApiDataContext**](ApiDataContext.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="read_data_context" id="read_data_context"></a>
# **read_data_context**
> ApiDataContext read_data_context(data_context_name)

Reads information about a datacontext.

Reads information about a datacontext.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.DataContextsResourceApi(cm_client.ApiClient(configuration))
data_context_name = 'data_context_name_example' # str | Name of the datacontext.

try:
    # Reads information about a datacontext.
    api_response = api_instance.read_data_context(data_context_name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataContextsResourceApi->read_data_context: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **data_context_name** | **str**| Name of the datacontext. | 

### Return type

[**ApiDataContext**](ApiDataContext.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="read_data_contexts" id="read_data_contexts"></a>
# **read_data_contexts**
> ApiDataContextList read_data_contexts()

Get all the datacontexts.

Get all the datacontexts.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.DataContextsResourceApi(cm_client.ApiClient(configuration))

try:
    # Get all the datacontexts.
    api_response = api_instance.read_data_contexts()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataContextsResourceApi->read_data_contexts: %s\n" % e)
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**ApiDataContextList**](ApiDataContextList.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: Not defined
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a name="update_data_context" id="update_data_context"></a>
# **update_data_context**
> ApiDataContext update_data_context(body=body)

Update a datacontext.

Update a datacontext. Following are are required fields of ApiDataContext: ApiDataContext#getName(), services.

### Example
```python
from __future__ import print_function
import time
import cm_client
from cm_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basic
configuration = cm_client.Configuration()
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# create an instance of the API class
api_instance = cm_client.DataContextsResourceApi(cm_client.ApiClient(configuration))
body = cm_client.ApiDataContext() # ApiDataContext | DataContext to be updated. (optional)

try:
    # Update a datacontext.
    api_response = api_instance.update_data_context(body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataContextsResourceApi->update_data_context: %s\n" % e)
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**ApiDataContext**](ApiDataContext.md)| DataContext to be updated. | [optional] 

### Return type

[**ApiDataContext**](ApiDataContext.md)

### Authorization

[basic](../README.md#basic)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

