Import User Accounts from a Flat File Using REST APIs

Some target applications do not support synchronization with Oracle Identity Cloud Service. You can onboard the user accounts from these applications by importing the accounts from a flat file using REST APIs.

To import user accounts from a flat file:
  1. Create a CSV file for import in the following format or download the CSV file along with User data from the target system apps:
    ID, NAME, ACTIVE
    hercule.poirot@sampleapp.com,hercule.poirot@sampleapp.com,true

    This table provides a description of the attributes in the CSV format file:

    Attribute Name Description Sample Value

    ID

    The unique identifier of the account in the target. The ID should match the target attribute that is defined for this application.

    hercule.poirot@sampleapp.com

    NAME

    The name of the account.

    hercule.poirot@sampleapp.com

    ACTIVE

    The status of the account on the target. The possible values are true and false.

    true

  2. Upload the flat file to the storage server. You can use the below curl command to upload a file to storage using the tenant admin access token.
    curl -k
    -X POST
    -H "Authorization: Bearer <Tenant Admin Access Token Value>"
    -F "contentType=text/csv"
    -F "isPublic=false"
    -F file=@"/scratch/$USER/flatfile.csv" "https://<tenant base url>/storage/v1/Files"

    Make note of the fileName attribute from the response.

  3. To get the value of the application id, use the following request:
    curl -k 
    -X GET 
    -H "Authorization: Bearer <Tenant Admin Access Token Value>"
    -H "Content-Type:application/scim+json"
    "https://<tenant base url>.identity.oraclecloud.com/admin/v1/Apps?filter=displayName co \"<Your application name>\""

    Make note of the value of the id attribute from the response.

  4. To get the value for the resourceType, use the following request:.
    curl -k 
    -X GET 
    -H "Authorization: Bearer <Tenant Admin Access Token Value>"
    -H "Content-Type:application/scim+json"
    "https://<tenant base url>.identity.oraclecloud.com/admin/v1/Apps/<appID>?attributes=urn:ietf:params:scim:schemas:oracle:idcs:extension:managedapp:App:objectClasses"

    Copy the value of the objectClasses.resourceType from the response. The resourceType value has a prefix of "ManagedApp" followed by a GUID.

  5. Run the ManagedObjectSync reconciliation job using a json file with information of the resourceType and the csv file you uploaded.

    Create and save a JSON file with the following content:

    {
      "schemas": [
          "urn:ietf:params:scim:schemas:oracle:idcs:JobSchedule"
      ],
      "jobType":"ManagedObjectSync" ,
      "runNow":true,
       "parameters": [
      {
        "name": "resourceType",
        "value": "<Dynamic ResourceType ID from app>"
      },
      {
        "name": "isIncremental",
        "value": "false"
      },
      {
        "name": "isFileBased",
        "value": "true"
      },
      {
        "name": "fileURI",
        "value": "<fileName of the file in the storage. Format: files/201702110205/testFileName-1486778745812-5318.csv>"
      }]
    }

    POST request:

    curl -k
    -X POST
    -H "Content-Type:application/scim+json"
    -H "Authorization: Bearer <Tenant Admin Access Token Value>"
    -d @"/scratch/$USER/runjob.json"
    https://<tenant base url>/job/v1/JobSchedules
    After you run the command, verify that the users in the csv file have been assigned to the application.
  6. Optionally, you can check the status of the scheduled job using the JobHistories API. See REST API for Oracle Identity Cloud Service.