Quick guide to start consuming the File API.

This section has been prepared to give the developer a quick guide to start consuming the File API, under the assumption that the developer has a proper application created in the Visma Developer Portal, integrated with the File API and at least authorized to the sandbox tenant. For additional information, please visit this article.

The below information should be known:

  • Client-id
  • Client-secret
  • Tenant-id

Step 1: Request an Access Token

In order to make the necessary calls to retrieve the expected information from the HR Core system, a token needs to be requested.

This token will provide access to a particular tenant in a specific application. Hence, this step will require knowing the client-id, client-secret and tenant-id.

curl -X POST 
 'https://connect.visma.com/connect/token'
 -H 'Cache-Control: no-cache' 
 -H 'Content-Type: application/x-www-form-urlencoded' 
 -d 'client_secret=xxxxxxx
     &client_id=xxxxxxxx
     &tenant_id=xxxxxxxx
     &grant_type=client_credentials'

Below, a response example containing the access token, the authorized scopes and the expiration time which is 1 hour max. After that time Apps need to re-authenticate to get a new access token.

{
    'access_token':'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
    'expires_in': '3600',
    'token_type': 'Bearer',
    "scope": "youforce-fileapi:files:list youforce-fileapi:files:upload"
}

Step 2: Request to File API Endpoint including the access token

App must use the Authorization header containing the access token for an specific tenant.

You can perform below actions as publisher of the file types:

  • Upload
  • List uploaded files
  • Download uploaded files

As subscriber of the file types you can perform below actions:

  • List delivered Files
  • Download
  • Delete

By default,sandbox applications are authorized to the Sandbox File Types:

Business Type Id Name Authorization
7100 File API Sandbox Uploads Publisher
7101 File API Sandbox Downloads Subscriber

Below, a request example for listing sandbox files as subscriber:

curl -X GET 
 'https://fileapi.youforce.com/v1.0/files/%fileid%?role=subscriber' 
 -H 'Cache-Control: no-cache' 
 -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'

Examples to Integrate

Postman

A Postman collection is available, containing the basic methods a developer needs to start using the File API.

You can find the Postman collection on the left menu under the option Examples to Integrate - Postman.

Powershell

Powershell examples are also available, containing the basic functionality to upload or download multiple files to/from your local computer. These examples could be customized by you if you want to use them in your integration or could be just used for testing purposes.

You can find the Powershell examples on the left menu under the option Examples to Integrate - Powershell.