> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Import Courses

> Import Courses through public channels

Import Courses through public channels

```http theme={null}
POST https://services.leadconnectorhq.com/courses/courses-exporter/public/import
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Body

<ParamField body="locationId" type="string" required />

<ParamField body="userId" type="string" />

<ParamField body="products" type="object[]" required>
  <Expandable title="cada item">
    <ParamField body="title" type="string" required />

    <ParamField body="description" type="string" required />

    <ParamField body="imageUrl" type="string" />

    <ParamField body="categories" type="object[]" required>
      <Expandable title="cada item">
        <ParamField body="title" type="string" required />

        <ParamField body="visibility" type="string" required>
          Posibles valores: 'published', 'draft'
        </ParamField>

        <ParamField body="thumbnailUrl" type="string" />

        <ParamField body="posts" type="object[]">
          <Expandable title="cada item">
            <ParamField body="title" type="string" required />

            <ParamField body="visibility" type="string" required>
              Posibles valores: 'published', 'draft'
            </ParamField>

            <ParamField body="thumbnailUrl" type="string" />

            <ParamField body="contentType" type="string" required>
              Posibles valores: 'video', 'assignment', 'quiz'
            </ParamField>

            <ParamField body="description" type="string" required />

            <ParamField body="bucketVideoUrl" type="string" />

            <ParamField body="postMaterials" type="object[]">
              <Expandable title="cada item">
                <ParamField body="title" type="string" required />

                <ParamField body="type" type="string" required>
                  Posibles valores: 'pdf', 'image', 'docx', 'pptx', 'xlsx', 'html', 'dotx', 'epub', 'webp', 'gdoc', 'mp3', 'doc', 'txt', 'zip', 'ppt', 'key', 'htm', 'xls', 'odp', 'odt', 'rtf', 'm4a', 'ods', 'mp4', 'ai', 'avi', 'mov', 'wmv', 'mkv', 'wav', 'flac', 'ogg', 'png', 'jpeg', 'jpg', 'gif', 'bmp', 'tiff', 'svg', 'odg', 'sxw', 'sxc', 'sxi', 'rar', '7z', 'json', 'xml', 'csv', 'md', 'obj', 'stl', 'woff', 'ttf'
                </ParamField>

                <ParamField body="url" type="string" required />
              </Expandable>
            </ParamField>
          </Expandable>
        </ParamField>

        <ParamField body="subCategories" type="object[]">
          <Expandable title="cada item">
            <ParamField body="title" type="string" required />

            <ParamField body="visibility" type="string" required>
              Posibles valores: 'published', 'draft'
            </ParamField>

            <ParamField body="thumbnailUrl" type="string" />

            <ParamField body="posts" type="object[]">
              <Expandable title="cada item">
                <ParamField body="title" type="string" required />

                <ParamField body="visibility" type="string" required>
                  Posibles valores: 'published', 'draft'
                </ParamField>

                <ParamField body="thumbnailUrl" type="string" />

                <ParamField body="contentType" type="string" required>
                  Posibles valores: 'video', 'assignment', 'quiz'
                </ParamField>

                <ParamField body="description" type="string" required />

                <ParamField body="bucketVideoUrl" type="string" />

                <ParamField body="postMaterials" type="object[]" />
              </Expandable>
            </ParamField>
          </Expandable>
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="instructorDetails" type="object">
      <Expandable title="propiedades">
        <ParamField body="name" type="string" required />

        <ParamField body="description" type="string" required />
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

## Respuestas

<Accordion title="201 - Response" />

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST 'https://services.leadconnectorhq.com/courses/courses-exporter/public/import' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "locationId": "string",
    "userId": "string",
    "products": [
      {
        "title": "string",
        "description": "string",
        "imageUrl": "string",
        "categories": [
          {}
        ],
        "instructorDetails": {
          "name": "string",
          "description": "string"
        }
      }
    ]
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/courses/courses-exporter/public/import', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"locationId": "string", "userId": "string", "products": [{"title": "string", "description": "string", "imageUrl": "string", "categories": [{}], "instructorDetails": {"name": "string", "description": "string"}}]}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/courses/courses-exporter/public/import',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"locationId": "string", "userId": "string", "products": [{"title": "string", "description": "string", "imageUrl": "string", "categories": [{}], "instructorDetails": {"name": "string", "description": "string"}}]},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/courses/courses-exporter/public/import');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'locationId': 'string', 'userId': 'string', 'products': [{'title': 'string', 'description': 'string', 'imageUrl': 'string', 'categories': [{}], 'instructorDetails': {'name': 'string', 'description': 'string'}}]}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
