# DataContextsResourceApi

All URIs are relative to */api/v57*

Method | HTTP request | Description
------------- | ------------- | -------------
[**createDataContext**](DataContextsResourceApi.md#createDataContext) | **POST** /dataContexts | Create a datacontext.
[**deleteDataContext**](DataContextsResourceApi.md#deleteDataContext) | **DELETE** /dataContexts/{dataContextName} | Delete a datacontext.
[**readDataContext**](DataContextsResourceApi.md#readDataContext) | **GET** /dataContexts/{dataContextName} | Reads information about a datacontext.
[**readDataContexts**](DataContextsResourceApi.md#readDataContexts) | **GET** /dataContexts | Get all the datacontexts.
[**updateDataContext**](DataContextsResourceApi.md#updateDataContext) | **PUT** /dataContexts | Update a datacontext.

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

Create a datacontext.

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

### Example
```java
// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.DataContextsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

DataContextsResourceApi apiInstance = new DataContextsResourceApi();
ApiDataContext body = new ApiDataContext(); // ApiDataContext | DataContext to be created.
try {
    ApiDataContext result = apiInstance.createDataContext(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DataContextsResourceApi#createDataContext");
    e.printStackTrace();
}
```

### 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

<a name="deleteDataContext"></a>
# **deleteDataContext**
> ApiDataContext deleteDataContext(dataContextName)

Delete a datacontext.

Delete a datacontext.

### Example
```java
// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.DataContextsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

DataContextsResourceApi apiInstance = new DataContextsResourceApi();
String dataContextName = "dataContextName_example"; // String | Name of the datacontext.
try {
    ApiDataContext result = apiInstance.deleteDataContext(dataContextName);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DataContextsResourceApi#deleteDataContext");
    e.printStackTrace();
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **dataContextName** | **String**| Name of the datacontext. |

### Return type

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

### Authorization

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

### HTTP request headers

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

<a name="readDataContext"></a>
# **readDataContext**
> ApiDataContext readDataContext(dataContextName)

Reads information about a datacontext.

Reads information about a datacontext.

### Example
```java
// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.DataContextsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

DataContextsResourceApi apiInstance = new DataContextsResourceApi();
String dataContextName = "dataContextName_example"; // String | Name of the datacontext.
try {
    ApiDataContext result = apiInstance.readDataContext(dataContextName);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DataContextsResourceApi#readDataContext");
    e.printStackTrace();
}
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **dataContextName** | **String**| Name of the datacontext. |

### Return type

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

### Authorization

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

### HTTP request headers

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

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

Get all the datacontexts.

Get all the datacontexts.

### Example
```java
// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.DataContextsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

DataContextsResourceApi apiInstance = new DataContextsResourceApi();
try {
    ApiDataContextList result = apiInstance.readDataContexts();
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DataContextsResourceApi#readDataContexts");
    e.printStackTrace();
}
```

### 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

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

Update a datacontext.

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

### Example
```java
// Import classes:
//import com.cloudera.api.swagger.client.ApiClient;
//import com.cloudera.api.swagger.client.ApiException;
//import com.cloudera.api.swagger.client.Configuration;
//import com.cloudera.api.swagger.client.auth.*;
//import com.cloudera.api.swagger.DataContextsResourceApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basic
HttpBasicAuth basic = (HttpBasicAuth) defaultClient.getAuthentication("basic");
basic.setUsername("YOUR USERNAME");
basic.setPassword("YOUR PASSWORD");

DataContextsResourceApi apiInstance = new DataContextsResourceApi();
ApiDataContext body = new ApiDataContext(); // ApiDataContext | DataContext to be updated.
try {
    ApiDataContext result = apiInstance.updateDataContext(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling DataContextsResourceApi#updateDataContext");
    e.printStackTrace();
}
```

### 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

