# Using the REST API

Applications can interact with resources through HTTPS requests to specific URLs. Our REST API is designed exclusively for business-to-business (B2B) applications, and direct connections to the DDE using our data are not permitted to maintain data integrity and security.

### Making API Calls:

To interact with a resource, send an HTTPS request, including the resource URL, necessary headers (such as the access token), the method, request body, and query parameters. For example:

{% code fullWidth="false" %}

```bash
curl https://dde-api.data.imgarena.com/basketball/seasons \
  -X GET \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json'
```

{% endcode %}

### Resource URL:

Access resources via URLs, which vary for production (<https://dde-api.data.imgarena.com>) and simulation ([https://dde-api-sims.data.imgarena.com](https://dde-api.data.imgarena.com)) environments.

### HTTP Methods:

The request should specify the HTTP method, with options including:

* GET for reading or listing resources
* POST for creating resources
* PUT for updating resources
* DELETE for removing resources

### Headers and Query Parameters:

Incorporate HTTP and query parameters to convey additional call details, like authorisation and data format, or for specific needs in listing operations like sorting or filtering. For instance:

{% code overflow="wrap" %}

```bash
curl 'https://dde-api.data.imgarena.com/basketball/fixtures?status=Completed&type=Official' \
  -X GET \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Accept: application/json' 
```

{% endcode %}

### Response Handling:

* API calls yield JSON objects with the requested resources or an error list. Successful responses display an HTTP 200 status code, while errors have non-200 codes.
* The response for single object operations includes a JSON object with the resource type (like season or fixture).
* For list and search operations, expect a named array of objects (like seasons) and a cursor value for pagination. Please always check the cursor value in these operations to ensure it's finished item retrieval.

### Enrichment:

In our REST API, each action packet is enriched by adding player and team names. If the system doesn't find a player or team linked to a particular fixture in the enrichment packet, it logs a warning. The warning message will indicate `"Unknown player code: …"` or `"Unknown team code: …"` based on the missing information. When this occurs, the system replaces the missing name with an empty string `("")`. This approach alerts users to any inconsistencies while preserving the structural integrity of the data packet.
