Import Assets

post

/rest/v19/assets/actions/import

This operation exports an asset collection.

Request

Supported Media Types
Body ()
Root Schema : assets-importCollectionRequest
Type: object
Show Source
Back to Top

Response

Supported Media Types

Default Response

Body ()
Root Schema : assets-importCollectionResponse
Type: object
Show Source
Back to Top

Examples

The following example show how to invoke an Import action to process the uploaded CSV to import data using a POST request to the REST resource using cURL. It supports create, update, and delete operations. For more information about cURL, see Use cURL.

curl - X POST -H "Authorization: Bearer <token>" - H "Content-type: application/json"
https://sitename.oracle.com/rest/v19/assets/actions/import

Request Body Sample

{"fileName":"upload_1465847155416"}

Response Body Sample

{     
   "importLogFileName": "/rest/v19/files/assets_output_1465848183346"
}

Asynchronous Import Mode Examples

If you are importing a large amount of data, we recommend requesting an asynchronous response to prevent the import from timing out.

curl -H "Authorization: Bearer <token>" -L -X POST 'https://sitename.oracle.com/rest/v19//assets/actions/import' -H 'Prefer: respond-async' 
 -H 'Content-Type: application/json' 

Sample Request Body - Asynchronous Import Mode

{"fileName":"upload_1465847155416"}

Sample Asynchronous Import Mode - In Progress Response

{
  "progress": "processing",
  "links": [{
      "rel": "self",
      "href": "
https://sitename.oracle.com/rest/v19/asyncTasks/3022782546/status"
    }
  ],
  "completed": false,
  "requestStatus": "202"
}

Sample Asynchronous Import Mode - Successful Response

{
  "progress": "succeeded",
  "links": [{
      "rel": "related",
      "href": "https://sitename.oracle.com/rest/v19/asyncTasks/3022782559/response"
    }, {
      "rel": "self",
      "href": "https://sitename.oracle.com/rest/v19/asyncTasks/3022782559/status"
    }
  ],
  "completed": true,
  "requestStatus": 200
}

Sample Asynchronous Import Mode - Failed Response

{
  "progress": "failed",
  "links": [{
      "rel": "related",
      "href": "https://sitename.oracle.com/rest/v19/asyncTasks/3022782539/response"
    }, {
      "rel": "self",
      "href": "https://sitename.oracle.com/rest/v19/asyncTasks/3022782539/status"
    }
  ],
  "completed": true,
  "requestStatus": "500"
}

Asynchronous Import Task Details

After asynchronous asset import finishes successfully or with errors, additional import details can be retrieved using the asyncTasks links in the response. Sample asyncTasks outputs are listed below:

Successful Response Details

{
  "importLogFileName": "https://sitename.oracle.com/rest/v19/files/assets_output_1654830465679"
}

Failed Response Details

{
  "Instance": "assets",
  "o:errorDetails": [{
      "title": "Field _asset_custom_status doesn't exist or is not accessible in resource assets for current user."
    }
  ],
  "type": "https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
  "title": "Action import on resource assets failed."
}
Back to Top