> For the complete documentation index, see [llms.txt](https://interfacing.gitbook.io/interfacing-help-files/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://interfacing.gitbook.io/interfacing-help-files/interfacing-help-files-fr/developpeurs-de-solutions/api-and-information-repository/api-rest/cas-dutilisation-et-exemples/creer-un-objet.md).

# Créer un objet

Utilisez les points de terminaison suivants pour créer des objets dans IMS par programmation. Cas d’utilisation courants :

* Importer ou migrer du contenu structuré, comme des dossiers, des processus ou de la documentation.
* Synchroniser les données avec des systèmes externes, dans un sens ou dans les deux sens.
* Recevoir et traiter des webhooks provenant de Jira, d’outils de service ou de plateformes ETL.
* Générer du contenu IMS par programmation, à partir de code ou de modèles.

***

## Démarrage rapide

* **URL de base du point de terminaison :** <https://YOURIMS.interfacing.com/api/v1/items>
* **Authentification :** obtenez un jeton valide. Consultez [Authentification et gestion des jetons](/interfacing-help-files/interfacing-help-files-fr/developpeurs-de-solutions/api-and-information-repository/api-rest.md#authentification-et-gestion-des-jetons).
* **Documentation Swagger :** <https://YOURIMS.interfacing.com/api/v1/swagger/#/Common/createItem>

***

## Scénarios et exemples de code

### Scénario 1 : Créer un processus avec des tâches

Cet exemple montre comment créer un **processus de développement** avec trois tâches :

1. Rédiger les exigences.
2. Programmer l’application.
3. Effectuer les tests d’intégration.

Nous utilisons deux points de terminaison API :

* Un pour **créer le processus** (`POST /items`).
* Un autre pour **ajouter tous les nœuds de tâche** (`POST /process/nodes`).

#### Étape 1 : Créer le processus

Utilisez le point de terminaison `POST /items` pour créer un nouveau nœud de **processus**.

**Requête :**

```json
10:42:51.655 request:
1 > POST http://myims.interfacing.com/api/v1/items?draft=true
1 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
1 > X-Cache-Control: private
1 > Content-Type: application/json; charset=UTF-8
1 > Content-Length: 128
1 > Host: myims.interfacing.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
1 > Accept-Encoding: gzip,deflate
{
  "parent": {
    "nodeId": "0D6AF657-0C16-04E4-50BB-19E9A9D0FCBC"
  },
  "@type": "Process",
  "name": "Development Process",
  "nodeType": "PROCESS"
}
```

**Réponse :**

```json
10:42:51.745 response time in milliseconds: 89
1 < 200
1 < Server: nginx/1.21.6
1 < Date: Tue, 28 Jun 2022 14:42:51 GMT
1 < Content-Type: application/json
1 < X-Varnish: 590197
1 < Age: 0
1 < Via: 1.1 varnish (Varnish/7.1)
1 < Connection: keep-alive
1 < Transfer-Encoding: chunked
{
  "nodeSubTypeName": null,
  "userNodeSubType": null,
  "@type": "BaseElement",
  "nodeVersionId": "BF3A6E68-F79B-4CF8-9236-D7894044B657",
  "nodeType": "PROCESS",
  "creationDate": "2022-06-28T10:42:51.680-04:00",
  "nodeStatus": "IN_PROGRESS",
  "publishedNodeVersionId": null,
  "version": "0.0001",
  "nodeSubType": null,
  "modificationDate": "2022-06-28T10:42:51.680-04:00",
  "extensions": null,
  "deleted": false,
  "system": false,
  "referenceNumber": null,
  "name": "Development Process",
  "locked": false,
  "nodeId": "C9A2E210-BD57-4096-B107-EB79C9920500",
  "favorite": false
}
```

> Enregistrez le `nodeId` du nouveau processus (`C9A2E210-...`). Vous en aurez besoin à l’étape suivante.

#### Étape 2 : Ajouter des tâches au processus

Utilisez maintenant le point de terminaison `POST /process/nodes` pour ajouter les nœuds de tâche au processus créé.

**Requête :**

```json
10:42:51.756 request:
2 > POST http://myims.interfacing.com/api/v1/process/nodes?process=C9A2E210-BD57-4096-B107-EB79C9920500&draft=true
2 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
2 > X-Cache-Control: private
2 > Content-Type: application/json; charset=UTF-8
2 > Content-Length: 937
2 > Host: myims.interfacing.com
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
2 > Accept-Encoding: gzip,deflate
[
  {
    "sequenceNumber": 1,
    "topLeftY": 50,
    "topLeftX": 100,
    "@type": "TaskNode",
    "name": "Write Requirements",
    "width": 100,
    "edges": [
      {
        "sourceNodeId": "74e574e5-4777-425d-8588-576388fc94e2",
        "sourcePortPoint": {
          "x": 25,
          "y": 15
        },
        "targetNodeId": "a50b686e-d3a8-40db-be9e-fa216d040c26",
        "targetPortPoint": {
          "x": 75,
          "y": 20
        }
      }
    ],
    "editId": "74e574e5-4777-425d-8588-576388fc94e2",
    "nodeType": "TASK",
    "height": 50
  },
  {
    "sequenceNumber": 2,
    "topLeftY": 50,
    "topLeftX": 300,
    "@type": "TaskNode",
    "name": "Code Application",
    "width": 100,
    "edges": [
      {
        "sourceNodeId": "a50b686e-d3a8-40db-be9e-fa216d040c26",
        "sourcePortPoint": {
          "x": 125,
          "y": 15
        },
        "targetNodeId": "1486400e-30e7-4ce8-a944-78b382dcaee4",
        "targetPortPoint": {
          "x": 175,
          "y": 20
        }
      }
    ],
    "editId": "a50b686e-d3a8-40db-be9e-fa216d040c26",
    "nodeType": "TASK",
    "height": 50
  },
  {
    "sequenceNumber": 3,
    "topLeftY": 50,
    "topLeftX": 500,
    "@type": "TaskNode",
    "name": "Integration Tests",
    "width": 100,
    "editId": "1486400e-30e7-4ce8-a944-78b382dcaee4",
    "nodeType": "TASK",
    "height": 50
  }
]
```

**Réponse :**

```json
10:42:52.139 response time in milliseconds: 383
2 < 200
2 < Server: nginx/1.21.6
2 < Date: Tue, 28 Jun 2022 14:42:52 GMT
2 < Content-Type: application/json
2 < X-Varnish: 526213
2 < Age: 0
2 < Via: 1.1 varnish (Varnish/7.1)
2 < Connection: keep-alive
2 < Transfer-Encoding: chunked
[
  {
    "nodeSubTypeName": null,
    "userNodeSubType": null,
    "@type": "BaseElement",
    "nodeVersionId": "E6775E5C-08B5-4A1F-8717-9C1438E3929C",
    "editId": "74e574e5-4777-425d-8588-576388fc94e2",
    "nodeType": "TASK",
    "creationDate": "2022-06-28T10:42:51.847-04:00",
    "nodeStatus": "IN_PROGRESS",
    "publishedNodeVersionId": null,
    "version": "0.0002",
    "nodeSubType": null,
    "modificationDate": "2022-06-28T10:42:51.847-04:00",
    "extensions": null,
    "deleted": false,
    "system": false,
    "referenceNumber": null,
    "name": "Write Requirements",
    "locked": false,
    "nodeId": "5E8D7B08-74A4-43B4-B6F2-BD288448BEAE",
    "favorite": false
  },
  {
    "nodeSubTypeName": null,
    "userNodeSubType": null,
    "@type": "BaseElement",
    "nodeVersionId": "709D3C21-74CE-4BC0-BFCA-9102B923434D",
    "editId": "a50b686e-d3a8-40db-be9e-fa216d040c26",
    "nodeType": "TASK",
    "creationDate": "2022-06-28T10:42:51.897-04:00",
    "nodeStatus": "IN_PROGRESS",
    "publishedNodeVersionId": null,
    "version": "0.0002",
    "nodeSubType": null,
    "modificationDate": "2022-06-28T10:42:51.897-04:00",
    "extensions": null,
    "deleted": false,
    "system": false,
    "referenceNumber": null,
    "name": "Code Application",
    "locked": false,
    "nodeId": "9D58DB9B-611E-4A53-87C8-D0597DA8D7AB",
    "favorite": false
  },
  {
    "nodeSubTypeName": null,
    "userNodeSubType": null,
    "@type": "BaseElement",
    "nodeVersionId": "B1973029-DF12-49DA-8DF3-8FB53E8BC173",
    "editId": "1486400e-30e7-4ce8-a944-78b382dcaee4",
    "nodeType": "TASK",
    "creationDate": "2022-06-28T10:42:51.927-04:00",
    "nodeStatus": "IN_PROGRESS",
    "publishedNodeVersionId": null,
    "version": "0.0002",
    "nodeSubType": null,
    "modificationDate": "2022-06-28T10:42:51.927-04:00",
    "extensions": null,
    "deleted": false,
    "system": false,
    "referenceNumber": null,
    "name": "Integration Tests",
    "locked": false,
    "nodeId": "140222BF-3BC9-440B-9B4B-D21F0A1F826F",
    "favorite": false
  }
]
```

***

### Scénario 2 : Créer un document avec une pièce jointe

Dans cet exemple, nous utilisons deux points de terminaison API :

1. Un pour **téléverser le fichier**.
2. Un autre pour **créer un document qui référence ce fichier**.

#### Étape 1 : Téléverser le fichier

Pour téléverser un fichier, envoyez une requête `POST` avec son contenu dans le corps de la requête. Incluez un `resumableIdentifier`, une chaîne unique qui associe le fichier téléversé au document IMS.

Le système prend en charge les téléversements en plusieurs fragments. Cet exemple utilise un **téléversement à un seul fragment**, adapté à la plupart des cas. Indiquez aussi le nom du fichier avec `resumableFilename` et `resumableRelativePath`.

Pour un téléversement à un seul fragment, définissez les paramètres suivants sur `1` :

* `resumableChunkSize`
* `resumableChunkNumber`
* `resumableTotalSize`

**Requête :**

```json
15:35:04.960 request:
1 > POST http://myims.interfacing.com/bpc/upload/?resumableIdentifier=55762fcc-c28b-4579-8afb-4141ba07bdf3&resumableFilename=Authoring%20Tools%20Comparison%20(1).xlsx&resumableRelativePath=Authoring%20Tools%20Comparison%20(1).xlsx&resumableChunkSize=1&resumableChunkNumber=1&resumableTotalSize=1
1 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
1 > Content-Type: text/plain; charset=UTF-8
1 > Content-Length: 16
1 > Host: myims.interfacing.com
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
1 > Accept-Encoding: gzip,deflate
```

**Réponse :**

```json
15:35:04.962 response time in milliseconds: 2
1 < 200
1 < Connection: keep-alive
1 < Content-Length: 0
1 < Date: Wed, 08 Jun 2022 19:35:04 GMT
```

#### Étape 2 : Créer le document IMS

Lors de la création du document EPC, affectez le `resumableIdentifier` et le `resumableFilename` précédemment utilisés à `fileInfo.uploadIdentifier` et `fileInfo.name`, respectivement.

**Requête :**

```json
15:35:04.967 request:
2 > POST http://myims.interfacing.com/api/v1/items?draft=true
2 > Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
2 > Content-Type: application/json; charset=UTF-8
2 > Content-Length: 230
2 > Host: myims.interfacing.com
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15)
2 > Accept-Encoding: gzip,deflate
{
  "parent": {
    "nodeId": "7BC41685-BD57-44F2-8807-0143FDFC619C"
  },
  "documentType": "FILE",
  "@type": "Document",
  "name": "Authoring Tools",
  "fileInfo": {
    "uploadIdentifier": "55762fcc-c28b-4579-8afb-4141ba07bdf3",
    "name": "Authoring Tools Comparison (1).xlsx"
  },
  "nodeType": "DOCUMENT"
}
```

**Réponse :**

```json
15:35:05.007 response time in milliseconds: 39
2 < 200
2 < Server: nginx/1.21.6
2 < Date: Wed, 08 Jun 2022 19:35:05 GMT
2 < Content-Type: application/json
2 < Content-Length: 507
2 < X-Varnish: 721243
2 < Age: 0
2 < Via: 1.1 varnish (Varnish/7.1)
2 < Connection: keep-alive
{
  "nodeSubTypeName": null,
  "userNodeSubType": null,
  "@type": "BaseElement",
  "nodeVersionId": "D6B0A34B-5C2C-4E1C-9F00-41BCCE09AE74",
  "nodeType": "DOCUMENT",
  "creationDate": "2022-06-08T15:35:04.977-04:00",
  "nodeStatus": "IN_PROGRESS",
  "publishedNodeVersionId": null,
  "version": "0.0001",
  "nodeSubType": null,
  "modificationDate": "2022-06-08T15:35:04.977-04:00",
  "extensions": null,
  "deleted": false,
  "system": false,
  "referenceNumber": null,
  "name": "Authoring Tools",
  "locked": false,
  "nodeId": "172CAE08-D725-49CD-BC39-3008FB394DD6",
  "favorite": false
}
```

**Exemple CURL :**

```bash
curl --request POST --url 'http://myims.interfacing.com/bpc/upload/?resumableIdentifier=55762fcc-c28b-4579-8afb-4141ba07bdf3&resumableFilename=Authoring%20Tools%20Comparison%20(1).xlsx&resumableRelativePath=Authoring%20Tools%20Comparison%20(1).xlsx&resumableChunkSize=1&resumableChunkNumber=1&resumableTotalSize=1' --data @Authoring\ Tools\ Comparison\ \(1\).xlsx -b /tmp/cookie.tmp
```

```bash
curl --request POST --url 'https://myims.interfacing.com/api/v1/items?draft=true' --header 'Content-Type: application/json' -b /tmp/cookie.tmp \
--data '{
  "parent": {
    "nodeId": "7BC41685-BD57-44F2-8807-0143FDFC619C"
  },
  "documentType": "FILE",
  "@type": "Document",
  "name": "Authoring Tools",
  "fileInfo": {
    "uploadIdentifier": "55762fcc-c28b-4579-8afb-4141ba07bdf3",
    "name": "Authoring Tools Comparison (1).xlsx"
  },
  "nodeType": "DOCUMENT"
}'
```

{% hint style="info" %}
Tout objet disponible dans IMS peut être créé avec l’API. Cela inclut les ressources, les actifs, les contrôles, les risques et les règles.
{% endhint %}

***

## À quelle fonctionnalité IMS cela correspond-il ?

Les **objets IMS** sont les éléments individuels stockés dans l’application web IMS. Ils comprennent des dossiers et divers types de contenu, comme les rôles, les termes, les documents et les règles.

Tous les objets sont organisés dans la **Bibliothèque**. Selon son type, chaque objet dépend d’une **racine parente** spécifique. Par exemple, les termes dépendent de la racine Glossaire et les rôles de la racine Organisation.

***

## Voir aussi

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Authentification et gestion des jetons</td><td><a href="/interfacing-help-files/interfacing-help-files-fr/developpeurs-de-solutions/api-and-information-repository/api-rest.md#authentification-et-gestion-des-jetons">API REST</a></td><td><a href="https://content.gitbook.com/content/AgpNu7XmgN3Z9B8kIShD/blobs/DQLtctQLTOs0sgjURwgJ/IMS-V16-NAV-Home-Icons-5.png">IMS-V16-NAV-Home-Icons-5.png</a></td></tr><tr><td>Référence de l’API (Swagger)</td><td><a href="/interfacing-help-files/interfacing-help-files-fr/developpeurs-de-solutions/api-and-information-repository/api-rest/api-reference-swagger.md">API Reference (Swagger)</a></td><td><a href="https://content.gitbook.com/content/AgpNu7XmgN3Z9B8kIShD/blobs/ony9eUVasEC7cHrPfFn0/IMS-V16-NAV-Library-Icons-41.png">IMS-V16-NAV-Library-Icons-41.png</a></td></tr><tr><td>Effectuer d’autres cas d’utilisation</td><td><a href="/interfacing-help-files/interfacing-help-files-fr/developpeurs-de-solutions/api-and-information-repository/api-rest/cas-dutilisation-et-exemples/effectuer-dautres-cas-dutilisation.md">Effectuer d’autres cas d’utilisation</a></td><td><a href="https://content.gitbook.com/content/AgpNu7XmgN3Z9B8kIShD/blobs/q1F1diigeTjKR94GHSiL/IMS-V16-Intro-7.png">IMS-V16-Intro-7.png</a></td></tr></tbody></table>


---

# 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, and the optional `goal` query parameter:

```
GET https://interfacing.gitbook.io/interfacing-help-files/interfacing-help-files-fr/developpeurs-de-solutions/api-and-information-repository/api-rest/cas-dutilisation-et-exemples/creer-un-objet.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
