How to Set the Position of a Resource in the Oracle Field Service Cloud with the Smart Location API

Java

import static java.lang.System.out;

import java.time.LocalTime;

import toa.location.LocationPort;
import toa.location.LocationService;
import toa.location.SetPositionParams;
import toa.location.SetPositionParamsAttributes;
import toa.location.UserAuth;

public final class OfscSample {

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

    final LocationPort port = service.getLocationPort();

    final SetPositionParams req = new SetPositionParams();

    final UserAuth user = new UserAuth();

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

    user.setLogin("SampleLogin");

    user.setAuthString("f3a904e1b89e0433f4f9f4a453370f44c3791d632f8ba50757301ba46f11047f");

    user.setCompany("SampleCompany");

    req.setUser(user);

    req.setCompany("SampleCompany");

    req.setDevice("SampleDevice"); // external id, resource id or user id

    req.setLatitude(0d);

    req.setLongitude(0d);

    req.setTime(LocalTime.of(2017, 1, 1)); // requires customization

    final SetPositionParamsAttributes attributes = new SetPositionParamsAttributes();

    attributes.getAny().add(...); // only objects annotated with @XmlRootElement

    req.setAttributes(attributes);

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

}

Node.js

Python

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s