The following is an example of how to create a session to retrieve contract fields using REST API.

package example;

import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class APISessionExample {
	static final Logger LOG = LoggerFactory.getLogger(APISessionExample.class);
	static final String USERNAME = "username";
	static final String PASSWORD = "password";
	static final String APIBASE = "";

	static final String SESSION_ENDPOINT = APIBASE + "/session";
	static final String CONTRACT_ENDPOINT = APIBASE + "/contract/?q=&pageSize=1&page=0";

	public static void main(final String[] args) throws Exception {
		final String sessionId ="username", USERNAME).field("password", PASSWORD).asString().getBody();

		final JsonNode contract = Unirest.get(CONTRACT_ENDPOINT).header("Cookie", "NOVATUSSID=" + sessionId).asJson().getBody();"Retrieved data: " + contract.toString());


For more information, see the Session section of REST API Version 2.0 or REST API Version 1.0