The getChangedItems command returns all the changes to item records, from a specified point in time to the current time.
Input
Class |
Name |
Type |
Required |
Details |
ItemHistoryRequest |
userId |
String |
Yes |
The callers user name |
ItemHistoryRequest |
password |
String |
Yes |
The callers password |
ItemHistoryRequest |
returnRawXML |
|
|
|
ItemHistoryRequest |
startTimeSlice |
Date |
Yes |
The cutoff timestamp value is not included in the issues generated by this command; that is, the comparison is “item timestamp is greater than the cutoff timestamp.” |
ItemHistoryRequest |
endTimeSlice |
Date |
No |
The endTimeSlice is optional. If it omitted, there is no constraint on the end of the cutoff period. If it provided, the value must be greater than the value of cutoff. This is used to limit the items for which history is generated. |
ItemHistoryRequest |
userNameMask |
String |
No |
The optional userNameMask may be used to override the behavior setting named USERNAME_DISPLAY, for the duration of the execution of a single API call. This allows the developer to return the user names in a different format than the system-wide default. |
ItemHistoryRequest |
filters |
Array [] |
No |
List of filters for the history. |
ItemHistoryRequest |
startTimeSlice |
Date |
Yes |
The cutoff timestamp value is not included in the issues generated by this command; that is, the comparison is “item timestamp is greater than the cutoff timestamp.” |
Field |
id |
String |
Yes |
|
Field |
name |
String |
No |
|
Field |
value |
String |
No |
|
Field |
childOfFieldId |
String |
No |
|
Field |
repeatingRowField |
boolean |
No |
|
Field |
textAreaField |
boolean |
No |
|
Field |
typeOfUserField |
boolean |
No |
|
Output
Class |
Name |
Type |
Required |
Details |
ItemHistoryResponse |
success |
boolean |
Yes |
True is succeeded False if failed |
ItemHistoryResponse |
returnCode |
String |
No |
See Appendix for details |
ItemHistoryResponse |
returnMessage |
String |
No |
Human readable message |
ItemHistoryResponse |
xml |
String |
No |
A list of AttachmentBeans |
ItemHistoryResponse |
itemRecords |
Array [] |
No |
The date the attachment was added to the item |
ItemRecord |
numberOfItemRecordFields |
int |
Yes |
The number of field records in the child array |
ItemRecord |
numberOfItemRecordFields |
int |
Yes |
An array of ItemRecordField objects |
ItemRecordField |
fieldId |
String |
Yes |
The id of the field |
ItemRecordField |
fieldTitle |
String |
Yes |
The title of the field |
ItemRecordField |
fieldValue |
String |
Yes |
The value of the field |
ItemRecordField |
row |
int |
Yes |
The repeating row value |
Example
public static void testGetChangedItems(EVItemServiceStub stub) {
try {
GetChangedItemsDocument reqEnvelope = GetChangedItemsDocument.Factory.newInstance();
ItemHistoryRequest request = reqEnvelope.addNewGetChangedItems().addNewRequest();
Calendar startCal = new GregorianCalendar();
startCal.add(Calendar.DATE, -30);
// look back 30 days ago
Calendar endCal = new GregorianCalendar();
request.setUserId(ServiceClientHelper.ADMIN_USER_ID);
request.setPassword(ServiceClientHelper.ADMIN_PASSWORD);
request.setStartTimeSlice(startCal);
request.setEndTimeSlice(endCal);
request.setReturnRawXML(true);
GetChangedItemsResponseDocument resEnvelope = stub.getChangedItems(reqEnvelope);
ItemHistoryResponse response = resEnvelope.getGetChangedItemsResponse().getReturn();
if (response.getSuccess()) {
System.out.println("success: [" + response.getReturnCode() + "] : " +
response.getReturnMessage());
System.out.println("XML Report:n" + response.getXml());
for (ItemRecord record: response.getItemRecordsArray()) {
System.out.println(" ++++++++++++++ ");
System.out.println(" + New Record + ");
for (ItemRecordField field: record.getItemRecordFieldsArray()) {
System.out.println(" + New Field + ");
System.out.println(" - Field Id: " + field.getFieldId());
System.out.println(" - Value: " + field.getFieldValue());
System.out.println(" - Title: " + field.getFieldTitle());
System.out.println(" - Row: " + field.getRow());
}
}
} else {
System.out.println("failure: [" + response.getReturnCode() + "] : " +
response.getReturnMessage());
}
} catch (Exception e) {
e.printStackTrace();
System.err.println("nnn");
}
}