Software

How to Get a Document Record in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;
 
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
 
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 
public class HcmCloudSample {
 
  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();
 
    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));
 
    Response res = client.target("https://host/hcmRestApi/resources/11.13.18.05/documentRecords/hcmDocumentRecordId").request().get();
 
    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));
 
    client.close();
  }
 
}

REST API w/ Go

package main
 
import "github.com/go-resty/resty/v2"
 
import "fmt"
 
func main() {
  client := resty.New()
 
  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").Get("/hcmRestApi/resources/11.13.18.05/documentRecords/hcmDocumentRecordId")
 
  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }
 
}

REST API w/ Node.js

var https = require('https');
 
var req = https.get({ auth: 'apiUser:apiPassword', hostname: 'host', path: '/hcmRestApi/resources/11.13.18.05/documentRecords/hcmDocumentRecordId' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';

    res.on('data', (chunk) => {
      body += chunk.toString();
    });

    res.on('end', () => {
      console.log(body);
    });

  }

});
 
req.end();

REST API w/ Python

import requests

res = requests.get('https://host/hcmRestApi/resources/11.13.18.05/documentRecords/hcmDocumentRecordId', auth = ( 'apiUser', 'apiPassword'))

print(res)

print(res.text)

REST API w/ Ruby

require 'rest-client'
 
res = RestClient.get 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/documentRecords/hcmDocumentRecordId'

if res.code == 200
  puts res.body
end
Software

How to List Document Records in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;
 
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
 
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 
public class HcmCloudSample {
 
  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();
 
    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));
 
    Response res = client.target("https://host/hcmRestApi/resources/11.13.18.05/documentRecords?q=PersonId=hcmPersonId").request().get();
 
    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));
 
    client.close();
  }
 
}

REST API w/ Go

package main
 
import "github.com/go-resty/resty/v2"
 
import "fmt"
 
func main() {
  client := resty.New()
 
  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").Get("/hcmRestApi/resources/11.13.18.05/documentRecords?q=PersonId=hcmPersonId")
 
  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }
 
}

REST API w/ Node.js

var https = require('https');
 
var req = https.get({ auth: 'apiUser:apiPassword', hostname: 'host', path: '/hcmRestApi/resources/11.13.18.05/documentRecords?q=PersonId=hcmPersonId' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';

    res.on('data', (chunk) => {
      body += chunk.toString();
    });

    res.on('end', () => {
      console.log(body);
    });

  }

});
 
req.end();

REST API w/ Python

import requests

res = requests.get('https://host/hcmRestApi/resources/11.13.18.05/documentRecords?q=PersonId=hcmPersonId', auth = ( 'apiUser', 'apiPassword'))

print(res)

print(res.text)

REST API w/ Ruby

require 'rest-client'
 
res = RestClient.get 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/documentRecords?q=PersonId=hcmPersonId'

if res.code == 200
  puts res.body
end
Software

How to Create a Document Record in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;

import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

public class HcmCloudSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));

    client.target("https://host/hcmRestApi/resources/11.13.18.05/documentRecords").post(Entity.json("{ \"attachments\": [ { \"FileContents\": \"...\", \"FileName\": \"Birth Certificate.jpg\" } ], \"DocumentType\": \"Birth\", \"PersonId\": \"hcmPersonId\" }")); // file contents must be base64-encoded, mandatory fields vary by document type

    client.close();
  }

}

REST API w/ Go

package main

import "github.com/go-resty/resty/v2"

func main() {
  client := resty.New()

  client.R().SetBasicAuth("apiUser", "apiPassword").SetHeader("Content-Type", "application/json").SetBody(`{ "attachments": [ { "FileContents": "...", "FileName": "Birth Certificate.jpg" } ], "DocumentType": "Birth", "PersonId": "hcmPersonId" }`).Post("https://host/hcmRestApi/resources/11.13.18.05/documentRecords") # file contents must be base64-encoded, mandatory fields vary by document type
}

REST API w/ Node.js

var https = require('https');

var req = https.request({ auth: 'apiUser:apiPassword', headers: { 'Content-Type': 'application/json' }, hostname: 'host', method: 'POST', path: '/hcmRestApi/resources/11.13.18.05/documentRecords' });

req.write('{ "attachments": [ { "FileContents": "...", "FileName": "Birth Certificate.jpg" } ], "DocumentType": "Birth", "PersonId": "hcmPersonId" }'); // file contents must be base64-encoded, mandatory fields vary by document type

req.end();

REST API w/ Python

import requests

requests.post('https://host/hcmRestApi/resources/11.13.18.05/documentRecords', json = { "attachments": ({ 'FileContents': '...', 'FileName': 'Birth Certificate.jpg' }), 'DocumentType': 'Birth', 'PersonId': 'hcmPersonId' }, auth = ( 'apiUser', 'apiPassword')) # file contents must be base64-encoded, mandatory fields vary by document type

REST API w/ Ruby

require 'rest-client'

RestClient.post 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/documentRecords', '{ "attachments": [ { "FileContents": "...", "FileName": "Birth Certificate.jpg" } ], "DocumentType": "Birth", "PersonId": "hcmPersonId" }', :content_type => 'application/json' # file contents must be base64-encoded, mandatory fields vary by document type
Software

How to Set the Profile Photo of an Employee in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;

import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

public class HcmCloudSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));

    client.target("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId/child/photo").post(Entity.json("{ \"Image\": ..., \"PrimaryFlag\": true }")); // image must be base64-encoded

    client.close();
  }

}

REST API w/ Go

package main

import "github.com/go-resty/resty/v2"

func main() {
  client := resty.New()

  client.R().SetBasicAuth("apiUser", "apiPassword").SetHeader("Content-Type", "application/json").SetBody(`{ "Image": ..., "PrimaryFlag": true }"`).Post("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId/child/photo") # image must be base64-encoded
}

REST API w/ Node.js

var https = require('https');

var req = https.request({ auth: 'apiUser:apiPassword', headers: { 'Content-Type': 'application/json' }, hostname: 'host', method: 'POST', path: '/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId' });

req.write('{ "Image": ..., "PrimaryFlag": true }'); // image must be base64-encoded

req.end();

REST API w/ Python

import requests

requests.post('https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId/child/photo', json = { 'Image': ..., 'PrimaryFlag': True }, auth = ( 'apiUser', 'apiPassword')) # image must be base64-encoded

REST API w/ Ruby

require 'rest-client'

RestClient.post 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId/child/photo', '{ "Image": ..., "PrimaryFlag": true }', :content_type => 'application/json' # image must be base64-encoded
Software

How to Get the Profile Photo of an Employee in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;
 
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
 
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 
public class HcmCloudSample {
 
  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();
 
    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));
 
    Response res = client.target("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=photo:*").request().get();
 
    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));
 
    client.close();
  }
 
}

REST API w/ Go

package main
 
import "github.com/go-resty/resty/v2"
 
import "fmt"
 
func main() {
  client := resty.New()
 
  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").Get("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=photo:*")
 
  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }
 
}

REST API w/ Node.js

var https = require('https');
 
var req = https.get({ auth: 'apiUser:apiPassword', hostname: 'host', path: '/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=photo:*' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';

    res.on('data', (chunk) => {
      body += chunk.toString();
    });

    res.on('end', () => {
      console.log(body);
    });

  }

});
 
req.end();

REST API w/ Python

import requests

res = requests.get('https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=photo:*', auth = ( 'apiUser', 'apiPassword'))

print(res)

print(res.text)

REST API w/ Ruby

require 'rest-client'
 
res = RestClient.get 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=photo:*'

if res.code == 200
  puts res.body
end
Software

How to Set the Marital Status of an Employee in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;

import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

public class HcmCloudSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);

    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));

    Response res = client.target("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId").request().method("PATCH", Entity.json("{ \"MaritalStatus\": \"hcmMaritalStatus\" }")); // refer to the "MAR_STATUS" lookup for marital statuses

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

REST API w/ Go

package main

import "github.com/go-resty/resty/v2"

import "fmt"

func main() {
  client := resty.New()

  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").SetHeader("Content-Type", "application/json").SetBody(`{ "MaritalStatus": "hcmMaritalStatus" }`).Patch("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId") // refer to the "MAR_STATUS" lookup for marital statuses

  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }

}

REST API w/ Node.js

var https = require('https');

var req = https.request({ auth: 'apiUser:apiPassword', headers: { 'Content-Type': 'application/json' }, hostname: 'host', method: 'PATCH', path: '/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId' });

req.write('{ "MaritalStatus": "hcmMaritalStatus" }'); // refer to the "MAR_STATUS" lookup for marital statuses

req.end();

REST API w/ Python

import requests

res = requests.patch('https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId', json = { 'MaritalStatus': 'hcmMaritalStatus' }, auth = ( 'apiUser', 'apiPassword')) # refer to the "MAR_STATUS" lookup for marital statuses

if res.ok:
  print(res.text)

REST API w/ Ruby

require 'rest-client'

res = RestClient.patch 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId', '{ "MaritalStatus": "hcmMaritalStatus" }', :content_type => 'application/json' # refer to the "MAR_STATUS lookup" for marital statuses

if res.code == 200
  puts res.body
end
Software

How to Get the Marital Status of an Employee in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;
 
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
 
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
 
public class HcmCloudSample {
 
  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();
 
    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));
 
    Response res = client.target("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=MaritalStatus").request().get();
 
    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));
 
    client.close();
  }
 
}

REST API w/ Go

package main
 
import "github.com/go-resty/resty/v2"
 
import "fmt"
 
func main() {
  client := resty.New()
 
  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").Get("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=MaritalStatus")
 
  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }
 
}

REST API w/ Node.js

var https = require('https');
 
var req = https.get({ auth: 'apiUser:apiPassword', hostname: 'host', path: '/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=MaritalStatus' }, (res) => {

  if (res.statusCode === 200) {
    var body = '';

    res.on('data', (chunk) => {
      body += chunk.toString();
    });

    res.on('end', () => {
      console.log(body);
    });

  }

});
 
req.end();

REST API w/ Python

import requests

res = requests.get('https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=MaritalStatus', auth = ( 'apiUser', 'apiPassword'))

print(res)

print(res.text)

REST API w/ Ruby

require 'rest-client'
 
res = RestClient.get 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId?fields=MaritalStatus'

if res.code == 200
  puts res.body
end
Software

How to Get an Employee in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;

import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

public class HcmCloudSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));

    Response res = client.target("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId").request().get();

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

REST API w/ Go

package main

import "github.com/go-resty/resty/v2"

import "fmt"

func main() {
  client := resty.New()

  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").Get("https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId")

  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }

}

REST API w/ Node.js

var https = require('https');

var req = https.get({ auth: 'apiUser:apiPassword', hostname: 'host', path: '/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId' }, (res) => {
 
  if (res.statusCode === 200) {
    var body = '';
 
    res.on('data', (chunk) => {
      body += chunk.toString();
    });
 
    res.on('end', () => {
      console.log(body);
    });
 
  }
 
});

req.end();

REST API w/ Python

import requests

res = requests.get('https://host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId', auth = ( 'apiUser', 'apiPassword'))

if res.ok:
  print(res.text)

REST API w/ Ruby

require 'rest-client'

res = RestClient.get 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/emps/hcmEmployeeId'

if res.code == 200
  puts res.body
end
Software

How to List Employees in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;

import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

public class HcmCloudSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));

    Response res = client.target("https://host/hcmRestApi/resources/11.13.18.05/emps").request().get();

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

REST API w/ Go

package main

import "github.com/go-resty/resty/v2"

import "fmt"

func main() {
  client := resty.New()

  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").Get("https://host/hcmRestApi/resources/11.13.18.05/emps")

  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }

}

REST API w/ Node.js

var https = require('https');

var req = https.get({ auth: 'apiUser:apiPassword', hostname: 'host', path: '/hcmRestApi/resources/11.13.18.05/emps' }, (res) => {
 
  if (res.statusCode === 200) {
    var body = '';
 
    res.on('data', (chunk) => {
      body += chunk.toString();
    });
 
    res.on('end', () => {
      console.log(body);
    });
 
  }
 
});

req.end();

REST API w/ Python

import requests

res = requests.get('https://host/hcmRestApi/resources/11.13.18.05/emps', auth = ( 'apiUser', 'apiPassword'))

if res.ok:
  print(res.text)

REST API w/ Ruby

require 'rest-client'

res = RestClient.get 'https://apiUser:apiPassword@host/hcmRestApi/resources/11.13.18.05/emps'

if res.code == 200
  puts res.body
end
Software

How to Enable/Disable an User in Oracle HCM Cloud

REST API w/ Java

import static java.lang.System.out;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;

import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;

public class HcmCloudSample {

  public static void main(String[] args) {
    Client client = ClientBuilder.newClient();

    client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);

    client.register(HttpAuthenticationFeature.basic("apiUser", "apiPassword"));

    Response res = client.target("https://host/hcmRestApi/scim/Users/hcmUserId").request().method("PATCH", Entity.json("{ \"schemas\": [ \"urn:scim:schemas:core:2.0:User\" ], \"active\": \"true\" }"));

    if (res.getStatus() == 200)
      out.println(res.readEntity(String.class));

    client.close();
  }

}

REST API w/ Go

package main

import "github.com/go-resty/resty/v2"

import "fmt"

func main() {
  client := resty.New()

  res, _ := client.R().SetBasicAuth("apiUser", "apiPassword").SetHeader("Content-Type", "application/json").SetBody(`{ "schemas": [ "urn:scim:schemas:core:2.0:User" ], "active": "true" }`).Patch("https://host/hcmRestApi/scim/Users/hcmUserId")

  if res.StatusCode() == 200 {
    fmt.Printf("%v\n", res)
  }

}

REST API w/ Node.js

var https = require('https');

var req = https.request({ auth: 'apiUser:apiPassword', headers: { 'Content-Type': 'application/json' }, hostname: 'host', method: 'PATCH', path: '/hcmRestApi/scim/Users/hcmUserId' });

req.write('{ "schemas": [ "urn:scim:schemas:core:2.0:User" ], "active": "true" }');

req.end();

REST API w/ Python

import requests

res = requests.patch('https://host/hcmRestApi/scim/Users/hcmUserId', json = { 'schemas': [ 'urn:scim:schemas:core:2.0:User' ], 'active': 'true' }, auth = ( 'apiUser', 'apiPassword'))

if res.ok:
  print(res.text)

REST API w/ Ruby

require 'rest-client'

res = RestClient.patch 'https://apiUser:apiPassword@host/hcmRestApi/scim/Users/hcmUserId', '{ "schemas": [ "urn:scim:schemas:core:2.0:User" ], "active": "true" }', :content_type => 'application/json'

if res.code == 200
  puts res.body
end