Tuesday, January 21, 2025

#1056 - OIC3 File Server Factory API

Introduction


You may be an OIC customer leveraging the File Server. You may also have use cases that require using the File Server REST API. If you're such a customer, read on!

Firstly, the File Server API docs are available here.

Always good to start there - now there are some subtle differences between usage of the OIC Integration Factory api and that for File Server. To begin with, you generate the OAuth token differently.

Generate a Token

So let's look at generating the token - here I'm using Postman - 

The url is - 

https://yourIDCS/oauth2/v1/token

As you can see, I use x-www-form-encoded as the format.

grant_type is set to password

scope is set to the 2 OIC scopes you use with the Integration factory api.

username and password is that of my OIC user.

Execute the POST request and you should get the token. If you get an unauthorized back, then check the IDCS app you are using - here is mine -

Validate IDCS App

Note, I've also checked Resource owner.

As you can see, I've added this app to the ServiceAdministrator role. There is a dependency between OIC role and what you can do with File Server. This is discussed in a upcoming section.

Net, net - you should be able to generate your token.

Using the token in a File Server API Request 

First api I invoke is - 

I realise the documentation format is somewhat different to the OIC REST API docs for integration etc. But don't fret - the protocol, host and base path are analogue to the integration api.

https://design.integration.yourRegion.ocp.oraclecloud.com/ic/api/fileserver/v1/services/sftp/configuration?integrationInstance=yourOICinstance

I copy and paste in the token and execute the request -

So that's the sanity test done. 

Now to creating a new folder...

Create a New Folder via the File Server API

Here's the Postman configuration - 

Request payload is - 
{"createdDate": "01-01-2025",
"name": "myFolder",
"parent": "{{fsPath}}"}


The {{fsPath}} refers to an environment variable I created -

 
Response - 

{
    "guid": "a75885b1e5dd473c8b9834b82bcd19d9",
    "path": "/home/users/niall.commiskey@oracle.com/myFolder",
    "createDate": null,
    "directories": [],
    "files": [],
    "links": [
        {
            "rel": "resource",
            "href": "/ic/api/fileserver/v1/filesystem/root/home/users/niall.commiskey@oracle.com/myFolder"
        },
        {
            "rel": "permission",
            "href": "/ic/api/fileserver/v1/filesystem/directories/a75885b1e5dd473c8b9834b82bcd19d9/permissions"
        }
    ]
}
I validate the creation of the new folder, by checking the File Server UI in OIC - 



OIC Roles & the File Server API

There is a dependency between OIC Roles and what you can do with the File Server REST api. The details are available here


Net, net - 

  • ServiceAdministrator role for the managing file server via the REST api.
  • ServiceDeveloper - read/write files via FTP Connection or StageFile action in OIC integrations.
  • ServiceUser - can access the File Server via an ftp client, such as FileZilla.
So your user needs to have the ServiceAdministrator role assigned to use these APIs.

Summa Summarum

File Server provides an embedded SFTP server within Oracle Integration, enabling organizations to focus on building automated business processes, without needing to host and maintain a separate SFTP server. This is a huge value-add for OIC customers; the factory api makes it even easier to adopt and manage this component.




 




 

No comments: