You are here: Catalog Elements > Service Agreement > serviceAgreementList

Retrieve List of Service Agreements

Description

Retrieves a list of service agreements containing their details such as, ID, name, and description.

Default Protocol Method Type URI
HTTPS GET serviceAgreementList.xml

Query Parameters

Parameter Description Valid Values Optional
lastModified Creation or Modification time stamp. Long Yes
refId1 Information that uniquely identifies the service agreement in a different ERP system. String Yes
refId2 Identifier 2 to store the unique record ID as used by external ERP/CRM systems. String Yes

Sample Code

import java.io.IOException;
import java.net.URLDecoder;

//..............................
//..............................
//..............................
import org.apache.http.params.HttpParams;
public class EMSSample {
	private static DefaultHttpClient httpclient = new DefaultHttpClient();
	private static Principal principal = null;
	private static StringBuffer query;
	//..............................
	//..............................
	//..............................
	public static String serviceAgreementList.xml()throws Exception  {
		if(!verifyLogin()){
			return "login failed";
		}
		HttpContext context = new BasicHttpContext();
		context.setAttribute(ClientContext.USER_TOKEN, principal);
		HttpGet get = new HttpGet("https://localhost:8443/ems/3.6/serviceAgreementList.xml");
		query = new StringBuffer();
		setParameter("refId2", "ref2");
		setParameter("lastModified", "1327379905000");
		setParameter("refId1", "ref1");
		get.setURI(new URI(URLDecoder.decode(get.getURI() + query.toString(),"UTF-8")));
		HttpResponse response = httpclient.execute(get, context);
		HttpEntity entity = response.getEntity();
		byte[] b = null;
		if (entity != null) {
			long l = entity.getContentLength();
			b = new byte[(int) l];
			entity.getContent().read(b);
			entity.consumeContent();
		}
		return new String(b);
	}
	static void setParameter(String key, String value) {
		if (query.toString().equals("")) {
			query.append("?" + key + "=" + value + "&");
		} else {
			query.append(key + "=" + value + "&");
		}
	}
}

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<emsResponse>
   <serviceAgreements>
      <serviceAgreement>
         <creationTime>1425870752000</creationTime>
         <description>Service Agreement Template definition</description>
         <modificationTime>1425870752000</modificationTime>
         <refId1 />
         <refId2 />
         <serviceAgreementId>1</serviceAgreementId>
         <serviceAgreementName>Service Agreement Template</serviceAgreementName>
      </serviceAgreement>
   </serviceAgreements>
   <stat>ok</stat>
   <total>1</total>
</emsResponse>
See Also:

Output Format for Failure

Error Codes

Error Code Description
100 Invalid request parameter.
101 You are not authorized to use this service.
102 Invalid data entered.
107 An internal error occurred! Please report the error to System administrator.
120 {field} value is less than the minimum permitted value {value}. [Note: This error code is applicable for the fields - productd, featureId,entId, billType, lmId, lastModified, timeZoneId, customerId, and granularity.]
128 You should log on first.
132 The URL address does not exist.
1080 {field} should be of dataType long. [Note: This error code is applicable for the field - lastModified.]
1081 Invalid Web service version provided
1084 No Web service version provided
1088 The EMS system is running on HTTPS. Please provide the correct Web service URL.