> For the complete documentation index, see [llms.txt](https://developer.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.mediarithmics.io/data-ingestion/bulk-processing/integration-batch.md).

# Integration batch

The integration batch is a plugin type used for customers' integrations. It can be periodic or non-periodic plugin. You can choose to pause a recurring plugin so that all the coming executions are canceled.

{% hint style="info" %}
You can check [plugins key concepts](/advanced-usages/plugins.md#key-concepts) to understand the hierarchy between a plugin, the versions, the instances and the executions.
{% endhint %}

Imagine you want to create a script that imports data every night for a customer :&#x20;

* You declare a new integration batch plugin called `import-data-for-customer`
* You declare a first `1.0.0` version for this plugin with the code of the script and the declaration of the script parameters
* Your script is now available for usage

To execute the script, you can :&#x20;

* Create an integration batch instance that will use the code from the 1.0.0 version with specific input parameters
* Either program the instance to automatically create executions at a specified cron, or manually create a new execution to start now or later.

## How-to

### Plugin creation

Use the [plugin creation](https://developer.mediarithmics.com/guides/plugins/deployment#create-the-plugin-and-its-version) endpoints to create a new plugin with the plugin type as `INTEGRATION_BATCH`. Everything else remains the same.

### Example

```bash
# Create the plugin definition
curl -X POST \
  https://api.mediarithmics.com/v1/plugins \
  -H 'Authorization: <YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
	"organisation_id": "my_organisation_id",
        "plugin_type": "INTEGRATION_BATCH",
        "group_id": "com.my-client.integration_batch",
        "artifact_id": "integration-batch-my-client"
}'
```

### Plugin version creation

Use the [plugin version creation](https://developer.mediarithmics.com/guides/plugins/deployment#create-the-plugin-and-its-version) endpoints to create a new plugin version with all the properties. The call and format are the same than usual.

### Example

```bash
# Create the plugin version
curl -X POST \
  https://api.mediarithmics.com/v1/plugins/<PLUGIN_ID>/versions \
  -H 'Authorization: <YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
	  "version_id":"1.0.0",
          "plugin_properties":[
        	  	{
        	     "technical_name": "one_more_property",
        	     "value": {
        	       "value": ""
        	     },
        	     "property_type": "STRING",
        	     "origin": "PLUGIN",
        	     "writable": true,
        	     "deletable": true
        	   },
                {
                    "technical_name": "provider",
                    "value": {
                        "value": "mediarithmics"
                    },
                    "property_type": "STRING",
                    "origin": "PLUGIN_STATIC",
                    "writable": false,
                    "deletable": false
                },
                {
                    "technical_name": "name",
                    "value": {
                        "value": "My Plugin Name"
                    },
                    "property_type": "STRING",
                    "origin": "PLUGIN_STATIC",
                    "writable": false,
                    "deletable": false
                }
        ]
}'
```

### Plugin instance creation

For the integration batch plugin, the instance is called  `integration_batch_instances`.&#x20;

There are five properties that are used for this plugin type: `cron` , `cron_status`, `ram_size`, `cpu_size` and `disk_size`.

The `cron` and the `cron_status` are not mandatory as you can create non-periodic jobs. If used, you should use them together.

The `ram_size` , `cpu_size` and `disk_size` are mandatory and the default values are set to `LOW`.

### Example

```bash
# Create the plugin instance
curl -X POST \
  https://api.mediarithmics.com/v1/integration_batch_instances \
  -H 'Authorization: <YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
	"group_id": "com.my-client.integration_batch",
        "artifact_id": "integration-batch-my-client",
        "version_id": "my-version-id",
        "organisation_id": "my-plugin-id",
        "name": "The name of my instance",
        "archived": false, 
        "cron" :"* * * 7 *",
        "cron_status": "ACTIVE | PAUSED",
        "ram_size": "LOW | MEDIUM | LARGE | EXTRA_LARGE",
        "disk_size": "LOW | MEDIUM | LARGE | EXTRA_LARGE",
        "cpu_size": "LOW | MEDIUM | LARGE | EXTRA_LARGE"
}'
```

You can perform the operations POST / PUT / GET and DELETE on the instances.&#x20;

### Integration batch execution creation

Executions can be created either automatically by the scheduler using the cron defined in the instance or manually using the API or the interface.&#x20;

When creating an execution you have to set the `execution_type` and `expected_start_date` properties.

```
// Create an execution
curl -X POST \
  https://api.mediarithmics.com/v1/integration_batch_instances/<INSTANCE_ID>/executions \
  -H 'Authorization: <YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
           "parameters": {
		execution_type: "MANUAL | CRON", 
		expected_start_date: 1562595783663
            },
           "organisation_id": "1185",
           "user_id": "1007",
           "error": null,
           "status": "PENDING",
           "external_model_id: "42",
           "external_model_name": "PUBLIC_INTEGRATION_BATCH",
           "start_date": 1562595789171,
           "job_type": "BATCH_INTEGRATION",
  }

```

You can perform the operations POST / PUT / GET and DELETE on the executions.

The execution\_type can be either `MANUAL` when created using the interface or `CRON` when created by the instance using the cron value set in the instance.

The expected\_start\_date is set by the timestamp chosen in the interface or by the cron set in the instance.&#x20;


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.mediarithmics.io/data-ingestion/bulk-processing/integration-batch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
