# Strapi v3

The destination Strapi v3 connector allows content to be transformed from motation and saved to Strapi versions 3.4.0 to 3.5.2&#x20;

## Specifics

The source Strapi v3 connector is able to sync both content and media files.&#x20;

### Syncing Collection Types

Given the way the Strapi system stores and manages collection types, it is best practice to not sync collection types to a destination Strapi. This means that collection types should be synced via the SCP connector or created prior to a content sync and aligning the source content to the destination content via Impulse's functionality.&#x20;

### UID Field

Impulse expects users to use the UID field provided in strapi as a UUID for contents. Rather than rely on the auto incrementing ID of contents use the UID field and provide every content a UUID so that it can be queried and searched for. This is not only the best way to work with Impulse, but also the best way to build your Strapi deployment.

This is field can be referenced in the job options. Performing a sync without the UID field created for a collection type and the job option set is unsupported. We expect you to set up your Strapi v3 system and the destination endpoint job option this way.&#x20;

### User Permissions

To sync content to the Strapi system, you will need to pass a user's login credentials into the endpoint config. The user requires the appropriate permissions to be able to sync the content. The permissions required are the same as the admin UI permissions. If the user is able to use the admin UI, it will work in Impulse.&#x20;

Because the adapters communicate with Strapi through Strapi’s REST API, the JWT timeout for that adapter user should be long enough to complete a sync.

The easiest option is to create a super user and use those credential for Impulse.&#x20;

### Same System Only

Strapi v3 has a few field types that are synced only to another Strapi system.&#x20;

Those fields are:&#x20;

* Relationships
* Component
* Dynamic Zone

### Endpoint Config

When saving an endpoint for a Strapi v3 repository via REST instead of the UI you must use the following key:value pairs in the payload.&#x20;

* `contentRepo:strapi`
* `contentRepoVersion:3.4.0`

### Unsupported

Users, roles, and permissions are unable to be synced.&#x20;

Multiple collection types per job. You can only sync one collection type per job. Setting multiple collection types will result in only one of them being synced.&#x20;

Syncing image files from a non Strapi source.&#x20;

Syncing relationships from a non Strapi source.&#x20;

DotCMS binary field is not populated with the image when synced to Strapi destination.

DotCMS constant field has no value when synced to Strapi destination.

DotCMS custom field has no value when synced to Strapi destination.

Strapi v3 adapter does not support running as a remote adapter apart from Impulse.

## Adapter Properties

| Property  | Purpose                                                 |
| --------- | ------------------------------------------------------- |
| strapiURL | The URL to access the Strapi system.                    |
| user      | The user with appropriate permissions.                  |
| password  | The password for the user with appropriate permission.  |

## Job Options

<table><thead><tr><th width="217">Name</th><th width="417">Description</th><th>Data Type</th><th>Required</th><th>Default Value</th><th data-hidden></th></tr></thead><tbody><tr><td>path</td><td>The path to pickup media files.</td><td>Array</td><td>No</td><td>No Default Value</td><td></td></tr><tr><td>contentType</td><td>The content type to pickup.</td><td>Array</td><td>No</td><td>No Default Value</td><td></td></tr><tr><td>uniqueId</td><td>Unique ID field of the collection types being synced to.</td><td>Array</td><td>No</td><td>No Default Value</td><td></td></tr><tr><td>deliverContentType</td><td>The option to deliver the collection type or not. </td><td>Boolean</td><td>No</td><td>true</td><td></td></tr></tbody></table>

### _path_ and _contentType_ Job Options

The _path_ and _contentType_ Job Options are used to search for contents that match the options criteria, the returned contents are used to compare against the source endpoint contents to define what needs to be synced to this destination connector.

#### Requesting specific contents of collection/single types.

To get the content of a collection type (or a single type) you must provide the API ID of the content type in the details of the endpoint like this:**`application::<api-id>.<api-id>`**

Example:&#x20;

![](https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FS7bCzFZCW3Yy1meHU7CC%2Fimage.png?alt=media\&token=77a041dc-45c4-4c3e-baa9-42b01c0852a7)

#### Syncing media files from the media library

Media files in the media library are treated as files that live under a path. As such, the details to get files would be as follows: **`/uploads/files/<file-id>`**

Example 1: all media files

![](https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FSncxuML5TJQMOu4yLeDx%2Fimage.png?alt=media\&token=7ca86cdd-2271-4859-b6be-4c81189dfc68)

Example 2: specific media file with Id 1

![](https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2Fi927nujeKXqPPdUKalW7%2Fimage.png?alt=media\&token=5acd5828-63d8-4877-9f94-3ec9326edb06)

Example 3: media files in a range

![](https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FpNAVy2AL4oAVYzrjj6BP%2Fimage.png?alt=media\&token=f48842a6-fe02-4de2-a7a6-7cdfacbd4f76)

This example will get all media files within the query range. I.e. 2 files starting at the second in the list.

Example 4: multiple media files by id

![](https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2F1Jn0D4eG9c61mYctLA1o%2Fimage.png?alt=media\&token=ceb5ffa6-f05a-499b-a22d-c3dd27ef60b2)

{% hint style="warning" %}
Note: This list may change order. It is based on modification date of the files. You may want to verify the query before using it.
{% endhint %}

### Using UID Field

To use the UID Field as the primary id to sync based off rather than the default content auto incrementing id, set the value of the **Uniqueid** job option with the following pattern: **`application::<api-id>.<api-id>.<UIDFieldName>`**

![](https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FESbNa5N90YTZHljAEy22%2Fimage.png?alt=media\&token=69e8ce1d-386e-4903-9d38-13780b9af417)

### Syncing Collection Types

To choose whether you sync a collection type or not set the **Delivercontenttype** job option. Best practice is to set this flag to false due to how Strapi handles creating and updating collection types.&#x20;

When setting this flag to False, it is then expected that the content model is fully managed through other options. I.e. Another job, manually, etc.

If the content models do not match between source and destination the content may not sync as expected. You can view the [Aligning Mismatched Content doc](../../getting-started/content-mapper/aligning-mismatched-content) for more information on how to handle this case.

![](https://651785290-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnLYwCtfZtrK4s43AVzb4%2Fuploads%2FmZ1N81rZVLoBmj4MdiHR%2Fimage.png?alt=media\&token=69031629-b839-4b4a-83a3-c111079fa0cd)

## Motation Object Support

| Object       | Supported |
| ------------ | --------- |
| Category     | No        |
| Definition   | Yes       |
| Domain       | No        |
| Folder       | No        |
| Language     | No        |
| Relationship | No        |
| Tag          | No        |

## Content Mapper

Below are details on how to find the appropriate values to use in the content mapper.&#x20;

* `mapping.uniqueId`&#x20;
  * Collection type's api id
* `fields.mapping.uniqueId`&#x20;
  * Field name (case sensitive)

## Troubleshooting

