> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/sdks-and-tools/universal-sdk-documentation/java/coreapi.md).

# CoreAPI

Use the CoreAPI to create an IDevice. IDevice is the bases for the MagTek Universal SDK.

If accessing a device specific API outside of MagTek Universal SDK, use the various functions in this section to create an instance of that device’s API. Once a device specific API is referenced, the associated library will need to be added into the application’s development project.

### getAPIVersion <a href="#id-3.1_getapiversion" id="id-3.1_getapiversion"></a>

This function returns the version of the MagTek Universal SDK.

{% code overflow="wrap" %}

```
int CoreAPI.getAPIVersion();
```

{% endcode %}

Return Value:

Returns integer.

### getDevice <a href="#id-3.2_getdevice" id="id-3.2_getdevice"></a>

This function returns an instance of a device.

{% code overflow="wrap" %}

```
IDevice CoreAPI.getDevice( 
    DeviceType deviceType, 
    ConnectionType connectionType, 
    String deviceAddress);
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="176.27276611328125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">deviceType</td><td valign="top">Enumerated device type.</td></tr><tr><td valign="top">connectionType</td><td valign="top">Enumerated connection type.</td></tr><tr><td valign="top"><p> </p><p> </p><p>deviceAddress</p></td><td valign="top"><p>Address for the device.</p><p> </p><p>For USB devices, address may be an empty string when only one device is attached. Otherwise address should be in the form:</p><p>USB://DEVICESERIALNUMBER</p><p>for example, USB://99261829170E0810</p></td></tr></tbody></table>

Return Value:

Returns an IDevice.

### getDeviceList <a href="#id-3.3_getdevicelist" id="id-3.3_getdevicelist"></a>

This function returns a list of IDevice.

{% code overflow="wrap" %}

```
List<IDevice> CoreAPI.getDeviceList(DeviceType deviceType); 

List<IDevice> CoreAPI.getDeviceList(DeviceType deviceType, ConnectionType connectionType);
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="183.54547119140625" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">deviceType</td><td valign="top">Enumerated device type.</td></tr><tr><td valign="top">connectionType</td><td valign="top">Enumerated connection type.</td></tr></tbody></table>

Return Value:

Returns List\<IDevice>.

### getConnectionTypes

This function returns a list of ConnectionType supported for a particular device type.

{% code overflow="wrap" %}

```
List<ConnectionType> CoreAPI.getConnectionTypes(DeviceType deviceType);
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="171.727294921875" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">deviceType</td><td valign="top">Enumerated device type.</td></tr></tbody></table>

Return Value:

Returns a list of List\<ConnectionType>.

### GetConnectionTypeString <a href="#id-3.5_getconnectiontypestring" id="id-3.5_getconnectiontypestring"></a>

This function returns a string for a connection type.

{% code overflow="wrap" %}

```
String CoreAPI.GetConnectionTypeString(ConnectionType connectionType);
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="156.27276611328125" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">connectionType</td><td valign="top">Enumerated connections type.</td></tr></tbody></table>

Return Value:

Returns a string for a connection type.

### GetConnectionTypeFromString <a href="#id-3.6_getconnectiontypefromstring" id="id-3.6_getconnectiontypefromstring"></a>

This function returns an enumerated connection type from a string.

{% code overflow="wrap" %}

```
ConnectionType CoreAPI.GetConnectionTypeFromString(String connectionType);
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="182.63641357421875" valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Parameter</td><td valign="top">Description</td></tr><tr><td valign="top">connectionType</td><td valign="top">Enumerated connections type.</td></tr></tbody></table>

Return Value:

Returns a ConnectionType.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.magtek.com/sdks-and-tools/universal-sdk-documentation/java/coreapi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
