---
title: Storage API
slug: storage-api
createdAt: 2022-10-09T11:50:30.000Z
---





# CSV Import/Export API

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/storage/file/import/s",
  "name": "Import data file",
  "method": "PUT",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "file",
        "type": "Object",
        "children": [],
        "description": "submitted file object"
      },
      {
        "kind": "required",
        "name": "request",
        "type": "Object",
        "children": [
          {
            "kind": "required",
            "name": "storageType",
            "type": "Integer",
            "description": "specifies the import file storage type.  For Import/Export, the only valid type should be StorageType.BusinessDocumentImports and SotrageType.BusienssDocumentExports"
          },
          {
            "kind": "required",
            "name": "ownerAccountId",
            "type": "Number",
            "description": "API server will always overwrite it with accountId obtained from authorized token"
          },
          {
            "kind": "required",
            "name": "importExportConfig",
            "type": "Object",
            "children": [
              {
                "kind": "required",
                "name": "systemDefinedFullClassName",
                "type": "string",
                "description": "a C# system full class name is required when requesting a file import/export for a specific system entity (e.g. specify \"OElite.Common.Marketing.Target\" is required for Target CSV import)"
              },
              {
                "kind": "optional",
                "name": "snapshotRecordCount",
                "type": "Number",
                "description": "specify whether to return a number of rows of uploaded file if it is a CSV file for import mapping"
              }
            ],
            "description": ""
          }
        ],
        "description": "file item data association data"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "NAXkCyJVBEBXSNdrcRyHP",
        "code": "{\n   \"data\":{\n      \"fileItemId\":987,\n      \"fileSnapshot\":{\n         \"headers\":[\n            \"Id\",\n            \"First Name\",\n            \"Last Name\",\n            \"Business Name\",\n            \"Is Hot Lead\",\n            \"Email\"\n         ],\n         \"records\":[\n            [\n               \"123\",\n               \"Susan1\",\n               \"Johns\",\n               \"Johns Pizza\",\n               \"true\",\n               \"susan1.johns@example.com\"\n            ],\n            [\n               \"124\",\n               \"Susan2\",\n               \"Johns\",\n               \"Johns Pizza\",\n               \"true\",\n               \"susan2.johns@example.com\"\n            ],\n            [\n               \"125\",\n               \"Susan3\",\n               \"Johns\",\n               \"Johns Pizza\",\n               \"true\",\n               \"susan3.johns@example.com\"\n            ],\n            [\n               \"126\",\n               \"Susan4\",\n               \"Johns\",\n               \"Johns Pizza\",\n               \"true\",\n               \"susan4.johns@example.com\"\n            ],\n            [\n               \"127\",\n               \"Susan5\",\n               \"Johns\",\n               \"Johns Pizza\",\n               \"true\",\n               \"susan5.johns@example.com\"\n            ]\n         ]\n      },\n      \"importEntityDataFields\":[\n         {\n            \"name\":\"First Name\",\n            \"alias\":\"target.firstName\",\n            \"valueType\":30,\n            \"isMandatory\":true\n         },\n         {\n            \"name\":\"Last Name\",\n            \"alias\":\"target.lastName\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Middle Name\",\n            \"alias\":\"target.middleName\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Date OfBirth\",\n            \"alias\":\"target.dob\",\n            \"valueType\":40,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Name\",\n            \"alias\":\"target.name\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Department\",\n            \"alias\":\"target.department\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Do Not Call\",\n            \"alias\":\"target.doNotCall\",\n            \"valueType\":11,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Do Not Call Requested By Recipieent\",\n            \"alias\":\"target.doNotCallRequestedByRecipient\",\n            \"valueType\":11,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Do Not Call Requested By Recipient On Date\",\n            \"alias\":\"target.doNotCallRequestedByRecipientOnUtc\",\n            \"valueType\":41,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Do Not Email\",\n            \"alias\":\"target.doNotEmail\",\n            \"valueType\":11,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Do Not Email Requested By Recipient\",\n            \"alias\":\"target.doNotEmailRequestedByRecipient\",\n            \"valueType\":11,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Do Not Email Requeested By Recipient On Date\",\n            \"alias\":\"target.doNotEmailRequestedByRecipientOnUtc\",\n            \"valueType\":41,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Home Phone Number\",\n            \"alias\":\"target.homePhoneNumber\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Work Phone Number\",\n            \"alias\":\"target.workPhoneNumber\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Mobile Phone Number\",\n            \"alias\":\"target.mobilePhoneNumber\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Fax Number\",\n            \"alias\":\"target.faxNumber\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Email\",\n            \"alias\":\"target.email\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"CampaignId\",\n            \"alias\":\"associatedCampaignId\",\n            \"valueType\":10,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"AssignedToUserId\",\n            \"alias\":\"assignedToUserId\",\n            \"valueType\":10,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Status\",\n            \"valueType\":30,\n            \"isMandatory\":false\n         }\n      ],\n      \"importAssociationDataFields\":[\n         {\n            \"name\":\"Campaign Id\",\n            \"alias\":\"target.associatedCampaignId\",\n            \"valueType\":10,\n            \"isMandatory\":false\n         },\n         {\n            \"name\":\"Assigned To User Id\",\n            \"alias\":\"target.assignedToUserId\",\n            \"valueType\":10,\n            \"isMandatory\":false\n         }\n      ]\n   }\n   \"success\":true\n}",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "PS4SMjAMl9hAeGvHqPt2c",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "NAXkCyJVBEBXSNdrcRyHP"
  },
  "examples": {
    "languages": [
      {
        "id": "6tbpCuNF55diTttap3Cwc",
        "code": "// Note: code represent FileItemAssociationData request json data only\n{\n\n   \"storageType\": 21,\n   \"importExportConfig\": {\n      \"systemDefinedFullClass\": \"OElite.Common.Marketing.Target\",\n      \"snapshotRecordCount\": 5\n   }\n   \n}",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "6tbpCuNF55diTttap3Cwc"
  },
  "description": "single file import endpoint.  ",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

**Response**

A **ResponseMessage** wrapped with **FileItemImportResponse** data object should be expected

***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "/storage/file/import/s/confirm/{fileItemId}",
  "name": "Confirm Import/Export Job",
  "method": "POST",
  "request": {
    "pathParameters": [
      {
        "kind": "required",
        "name": "fileItemId",
        "type": "Number",
        "children": [],
        "description": "the file item id of the newly uploaded import file (which is obtained from /storage/file/import/s  upload endpoint)"
      }
    ],
    "queryParameters": [],
    "headerParameters": [],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "request",
        "type": "Object",
        "children": [
          {
            "kind": "required",
            "name": "storageType",
            "type": "string",
            "description": "specifies the import file storage type.  For Import/Export, the only valid type should be StorageType.BusinessDocumentImports and SotrageType.BusienssDocumentExports"
          },
          {
            "kind": "required",
            "name": "ownerAccountId",
            "type": "Integer",
            "description": "provide if to associ"
          },
          {
            "kind": "required",
            "name": "importExportConfig",
            "type": "Object",
            "children": [
              {
                "kind": "required",
                "name": "systemDefinedFullClass",
                "type": "string",
                "description": "a C# system full class name is required when requesting a file import/export for a specific system entity (e.g. specify \"OElite.Common.Marketing.Target\" is required for Target CSV import)"
              },
              {
                "kind": "required",
                "name": "csvHeaderMappers",
                "type": "Array",
                "description": "an array of SimpleNameValuePair (angular) for mapping import/export csv headers with system designed object entity fields\n\nNote: the key should be the entifyFieldAlias obtained from the import upload endpoint"
              },
              {
                "kind": "optional",
                "name": "entityAssociations",
                "type": "Array",
                "description": "an array of SimpleNameValuePair (angular) for mapping any relationships of the imported records with other entities in the platform\n\nNote: the key should be the entifyFieldAlias obtained from the import upload endpoint"
              }
            ],
            "description": ""
          }
        ],
        "description": "file item data association data"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "tRic9ku3xmsN3fDj4uOb8",
        "code": "{\n   data: [],\n   totalRecordsCount: 0   \n}",
        "language": "200",
        "customLabel": ""
      },
      {
        "id": "xOPkDLemrsnjvwIijVwsq",
        "code": "{\n    \"message\": \"Ain't no cake like that.\"\n  }",
        "language": "404",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "tRic9ku3xmsN3fDj4uOb8"
  },
  "examples": {
    "languages": [
      {
        "id": "kA8dTVJvQpPit1MBqk0Tq",
        "code": "// Note: code represent FileItemAssociationData request json data only\n{\n\n   \"storageType\": 21,\n   \"importExportConfig\": {\n      \"systemDefinedFullClass\": \"OElite.Common.Marketing.Target\",\n      \"csvHeaderMappers\": {\n         \"target.firstName\": \"First Name\",\n         \"target.lastName\": \"Last Name\",\n         \"target.name\": \"Business Name\",\n         \"target.email\": \"Email\"\n      },\n      \"entityAssociations\": {\n         \"associatedCampaignId\": 234,\n         \"assignedToUserId:\" 8887\n      }\n   }\n}",
        "language": "json",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "kA8dTVJvQpPit1MBqk0Tq"
  },
  "description": "To confirm/update and trigger a file import/export job",
  "currentNewParameter": {
    "label": "Path Parameter",
    "value": "pathParameters"
  }
}
```
:::

**Response**

A **FileItemCollection** response should be expected. Which includes the confirmed import/export file(s) details









## ImportExportConfig:

During import:

- **CsvHeaderMappers** property contains the mapping of the uploaded custom csv headers against related system defined entities (such as Users, Targets, Leads, etc. )
- **EntityAssociations** property containers the mapping of the bespoke relationship the imported records with the defined field.  The system currently has the following defined fields:

| **entityAssociations** **field** | value type | description                                                                                                                                                          |
| -------------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| associatedCampaignId             | long       | if applicable, associate the imported records with a specified campaign.<br /><br /><u>Possible Record Types:</u><br />**Leads, Targets**                            |
| assignedToUserId                 | long       | if applicable, assign the imported records to a specified user<br /><br /><u>Possible Record Types:</u><br />**Campaigns, Leads, Targets, Opportunities, Customers** |
| associatedProductCategoryId      | long       | if applicable, associate the imported records with a specified product category<br /><br /><u>Possible Record Types:</u><br />**Products**                           |
