How to Authenticate an User in OCI Compute Classic

API w/ Java

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

public final class ComputeSample {

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

    client.target("https://host/authenticate/").request().post(Entity.entity("{ \"password\": \"samplePassword\", \"user\": \"sampleUser\" }", "application/oracle-cloud-v3+json"));

    client.close();
  }

}

API w/ Node.js

const https = require('https');

const req = https.request({ headers: { 'content-type': 'application/oracle-compute-v3+json' }, hostname: 'host', method: 'POST', path: '/authenticate/' });

req.write('{ "password": "samplePassword", "user": "sampleUser" }')

req.end();

API w/ Python

import requests

requests.post('https://host/authenticate/', headers = { 'content-type': 'application/oracle-compute-v3+json' },  json = { 'password': 'samplePassword', 'user': 'sampleUser' })

API w/ Ruby

require 'rest-client'

RestClient.post 'https://host/authenticate/', '{ "password": "samplePassword", "user": "sampleUser" } ', :content_type => 'application/oracle-compute-v3+json'

CLI

1) Run the following command:

opc compute authentications add samplePassword sampleUser
Advertisements

How to Get Start, End and Home Zone Center Resource Locations in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.GetResourcesLocationsElement;
import toatech.resourcemanagement._1.LocationResourceParams;
import toatech.resourcemanagement._1.LocationResourceParamsList;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetResourcesLocationsElement req = new GetResourcesLocationsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final LocationResourceParamsList resources = new LocationResourceParamsList();

    final LocationResourceParams resource = new LocationResourceParams();

    resource.setResourceId("SampleResource");

    resources.getResource().add(resource);

    req.setResources(resources);

    out.println(port.getResourcesLocations(req));
  }

}

Node.js

Python

Ruby

How to Set Start, End and Home Zone Center Resource Locations in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.ResourceLocationElement;
import toatech.resourcemanagement._1.ResourceLocationList;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.SetResourcesLocationsElement;
import toatech.resourcemanagement._1.WeekdaysList;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final SetResourcesLocationsElement req = new SetResourcesLocationsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final ResourceLocationList resourceLocations = new ResourceLocationList();

    final ResourceLocationElement resourceLocation = new ResourceLocationElement();

    resourceLocation.setResourceId("SampleResource");

    resourceLocation.setLocationLabel("Sample Location");

    resourceLocation.setType("start"); // or "end", "home_zone_center"

    final WeekdaysList weekdays = new WeekdaysList();

    weekdays.getWd().add("Mon"); // one of "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" or "all"

    resourceLocation.setWeekdays(weekdays);

    resourceLocations.getResourceLocation().add(resourceLocation);

    req.setResourceLocations(resourceLocations);

    out.println(port.setResourcesLocations(req));
  }

}

Node.js

Python

Ruby

How to Get Resource Locations in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.GetLocationsElement;
import toatech.resourcemanagement._1.LocationResourceParams;
import toatech.resourcemanagement._1.LocationResourceParamsList;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetLocationsElement req = new GetLocationsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final LocationResourceParamsList resources = new LocationResourceParamsList();

    final LocationResourceParams resource = new LocationResourceParams();

    resource.setResourceId("SampleResource");

    resources.getResource().add(resource);

    req.setResources(resources);

    out.println(port.getLocations(req));
  }

}

Node.js

Python

Ruby

How to Delete Resource Locations in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.LocationElement;
import toatech.resourcemanagement._1.LocationList;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.SetLocationsElement;
import toatech.resourcemanagement._1.TextPropertiesElement;
import toatech.resourcemanagement._1.TextPropertyElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final SetLocationsElement req = new SetLocationsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final LocationList locations = new LocationList();

    final LocationElement location = new LocationElement();

    final TextPropertiesElement properties = new TextPropertiesElement();

    final TextPropertyElement label = new TextPropertyElement();

    label.setName("label");

    label.setValue("Sample Location");

    properties.getProperty().add(label);

    final TextPropertyElement resourceId = new TextPropertyElement();

    resourceId.setName("resource_id");

    resourceId.setValue("SampleResource");

    properties.getProperty().add(resourceId);

    location.setProperties(properties);

    locations.getLocation().add(location);

    req.setLocations(locations);

    out.println(port.deleteLocations(req));
  }

}

Node.js

Python

Ruby

How to Create/Update Resource Locations in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.LocationElement;
import toatech.resourcemanagement._1.LocationList;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.SetLocationsElement;
import toatech.resourcemanagement._1.TextPropertiesElement;
import toatech.resourcemanagement._1.TextPropertyElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final SetLocationsElement req = new SetLocationsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final LocationList locations = new LocationList();

    final LocationElement location = new LocationElement();

    final TextPropertiesElement properties = new TextPropertiesElement();

    final TextPropertyElement label = new TextPropertyElement();

    label.setName("label");

    label.setValue("Sample Location");

    properties.getProperty().add(label);

    final TextPropertyElement resourceId = new TextPropertyElement();

    resourceId.setName("resource_id");

    resourceId.setValue("SampleResource");

    properties.getProperty().add(resourceId);

    location.setProperties(properties);

    locations.getLocation().add(location);

    req.setLocations(locations);

    out.println(port.updateLocations(req));
  }

}

Node.js

Python

Ruby

How to Get Resource Work Skills in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.GetResourcesParamsElement;
import toatech.resourcemanagement._1.GetResourcesParamsList;
import toatech.resourcemanagement._1.GetResourcesSkillsElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetResourcesSkillsElement req = new GetResourcesSkillsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final GetResourcesParamsList resources = new GetResourcesParamsList();

    final GetResourcesParamsElement resource = new GetResourcesParamsElement();

    resource.setResourceId("SampleResource");

    resources.getResource().add(resource);

    req.setResources(resources);

    out.println(port.getResourcesSkills(req));
  }

}

Node.js

Python

Ruby

How to Set Resource Work Skills in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.SetResourcesSkillsElement;
import toatech.resourcemanagement._1.SkillElement;
import toatech.resourcemanagement._1.SkillList;
import toatech.resourcemanagement._1.TextPropertiesElement;
import toatech.resourcemanagement._1.TextPropertyElement;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final SetResourcesSkillsElement req = new SetResourcesSkillsElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final SkillList skills = new SkillList();

    final SkillElement skill = new SkillElement();

    final TextPropertiesElement props = new TextPropertiesElement();

    final TextPropertyElement resourceId = new TextPropertyElement();

    resourceId.setName("resource_id");

    resourceId.setValue("SampleResource");

    props.getProperty().add(resourceId);

    final TextPropertyElement skill2 = new TextPropertyElement();

    skill2.setName("skill");

    skill2.setValue("SampleWorkSkill");

    props.getProperty().add(skill2);

    final TextPropertyElement ratio = new TextPropertyElement();

    ratio.setName("ratio");

    ratio.setValue("1");

    props.getProperty().add(ratio);

    skill.setProperties(props);

    skills.getSkill().add(skill);

    req.setSkills(skills);

    out.println(port.setResourcesSkills(req));
  }

}

Node.js

Python

Ruby

How to Get Resource Work Zones in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.GetResourcesParamsElement;
import toatech.resourcemanagement._1.GetResourcesParamsList;
import toatech.resourcemanagement._1.GetResourcesZonesElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final GetResourcesZonesElement req = new GetResourcesZonesElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final GetResourcesParamsList resources = new GetResourcesParamsList();

    final GetResourcesParamsElement resource = new GetResourcesParamsElement();

    resource.setDate("2017-01-01");

    resource.setResourceId("SampleResource");

    resources.getResource().add(resource);

    req.setResources(resources);

    out.println(port.getResourcesZones(req));
  }

}

Node.js

Python

Ruby

How to Set Resource Work Zones in the Oracle Field Service Cloud with the Resource Management API

Java

import static java.lang.System.out;

import toatech.resourcemanagement._1.AuthNodeElement;
import toatech.resourcemanagement._1.ResourceManagementPort;
import toatech.resourcemanagement._1.ResourceManagementService;
import toatech.resourcemanagement._1.SetResourcesZonesElement;
import toatech.resourcemanagement._1.TextPropertiesElement;
import toatech.resourcemanagement._1.TextPropertyElement;
import toatech.resourcemanagement._1.ZoneElement;
import toatech.resourcemanagement._1.ZoneList;

public final class OfscSample {

  public static void main(final String[] args) {
    final ResourceManagementService service = new ResourceManagementService();

    final ResourceManagementPort port = service.getResourceManagementPort();

    final SetResourcesZonesElement req = new SetResourcesZonesElement();

    final AuthNodeElement user = new AuthNodeElement();

    user.setNow("2017-01-01T00:00:00Z");

    user.setLogin("SampleLogin");

    user.setCompany("SampleCompany");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    req.setUser(user);

    final ZoneList zones = new ZoneList();

    final ZoneElement zone = new ZoneElement();

    final TextPropertiesElement props = new TextPropertiesElement();

    final TextPropertyElement date = new TextPropertyElement();

    date.setName("date");

    date.setValue("2017-01-01");

    props.getProperty().add(date);

    final TextPropertyElement resourceId = new TextPropertyElement();

    resourceId.setName("resource_id");

    resourceId.setValue("1");

    props.getProperty().add(resourceId);

    final TextPropertyElement zone2 = new TextPropertyElement();

    zone2.setName("zone");

    zone2.setValue("Sample Work Zone");

    props.getProperty().add(zone2);

    final TextPropertyElement ratio = new TextPropertyElement();

    ratio.setName("ratio");

    ratio.setValue("1");

    props.getProperty().add(ratio);

    zone.setProperties(props);

    zones.getZone().add(zone);

    req.setZones(zones);

    out.println(port.setResourcesZones(req));
  }

}

Node.js

Python

Ruby