Closed afawcett closed 10 years ago
There is no REST version, so would make the API a hybrid between REST and SOAP, though this can be kept transparent from the caller.
RE: getUpdated and getDeleted, these do work for things like ApexClass, ApexPage, StaticResource etc, but offer no more functionality than the native ones, both reject the CustomObject and CustomField object names if passed, which are the two i really wanted in order to implement a Setup Monitoring solution, shame!
For safe keeping, the following is the partial SOAP types and methods i added to ToolingAPI temporarily to test this out, just in case we want to add some SOAP operations back in in the future...
Test code...
ToolingAPI toolingAPI = new ToolingAPI();
toolingAPI.SessionHeader = new ToolingAPI.SessionHeader_element();
toolingAPI.SessionHeader.sessionId = UserInfo.getSessionId();
ToolingAPI.GetUpdatedResult updatedResult =
toolingAPI.getUpdated('CustomObject', Datetime.now().addHours(-1), Datetime.now());
System.debug(updatedResult);
Stub code...
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public SessionHeader_element SessionHeader;
public Integer timeout_x;
private String SessionHeader_hns = 'SessionHeader=urn:tooling.soap.sforce.com';
private String[] ns_map_type_info = new String[]{'urn:tooling.soap.sforce.com', 'toolingSoapSforceCom'};
public class SessionHeader_element {
public String sessionId;
private String[] sessionId_type_info = new String[]{'sessionId','urn:tooling.soap.sforce.com',null,'1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:tooling.soap.sforce.com','true','false'};
private String[] field_order_type_info = new String[]{'sessionId'};
}
public class getUpdated_element {
public String sObjectType;
public DateTime start;
public DateTime end_x;
private String[] sObjectType_type_info = new String[]{'sObjectType','urn:tooling.soap.sforce.com',null,'1','1','false'};
private String[] start_type_info = new String[]{'start','urn:tooling.soap.sforce.com',null,'1','1','false'};
private String[] end_x_type_info = new String[]{'end','urn:tooling.soap.sforce.com',null,'1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:tooling.soap.sforce.com','true','false'};
private String[] field_order_type_info = new String[]{'sObjectType','start','end_x'};
}
public class getUpdatedResponse_element {
public GetUpdatedResult result;
private String[] result_type_info = new String[]{'result','urn:tooling.soap.sforce.com',null,'1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:tooling.soap.sforce.com','true','false'};
private String[] field_order_type_info = new String[]{'result'};
}
public class GetUpdatedResult {
public String[] ids;
public DateTime latestDateCovered;
private String[] ids_type_info = new String[]{'ids','urn:tooling.soap.sforce.com',null,'0','-1','false'};
private String[] latestDateCovered_type_info = new String[]{'latestDateCovered','urn:tooling.soap.sforce.com',null,'1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:tooling.soap.sforce.com','true','false'};
private String[] field_order_type_info = new String[]{'ids','latestDateCovered'};
}
public GetUpdatedResult getUpdated(String sObjectType,DateTime start,DateTime end_x) {
getUpdated_element request_x = new getUpdated_element();
getUpdatedResponse_element response_x;
request_x.sObjectType = sObjectType;
request_x.start = start;
request_x.end_x = end_x;
Map<String, getUpdatedResponse_element> response_map_x = new Map<String, getUpdatedResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{URL.getSalesforceBaseUrl().toExternalForm()+'/services/Soap/T/29.0',
'',
'urn:tooling.soap.sforce.com',
'getUpdated',
'urn:tooling.soap.sforce.com',
'getUpdatedResponse',
'ToolingAPI.getUpdatedResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.result;
}
If these work, could be quite interesting in respect to the Tooling API object records!