@@ -41,6 +41,18 @@ public class RestApiClient implements ApiClient {
4141 static {
4242 HEADERS = Collections .singletonMap ("SoftLayer-Include-Types" , Collections .singletonList ("true" ));
4343 }
44+
45+ /**
46+ * A list of service methods that do not have to be added to the REST URL.
47+ * createObjects is supposed to work, but does not.
48+ */
49+ private static final List <String > IMPLICIT_SERVICE_METHODS = Arrays .asList (
50+ "getObject" ,
51+ "deleteObject" ,
52+ "createObject" ,
53+ "editObject" ,
54+ "editObjects"
55+ );
4456
4557 private final String baseUrl ;
4658 private HttpClientFactory httpClientFactory ;
@@ -135,7 +147,18 @@ protected String getHttpMethodFromMethodName(String methodName) {
135147 return "GET" ;
136148 }
137149 }
138-
150+
151+ /**
152+ * Get the full REST URL required to make a request.
153+ *
154+ * @param serviceName The name of the API service.
155+ * @param methodName The name of the method on the service to call.
156+ * @param id The identifier of the object to make a call to,
157+ * otherwise null if not making a request to a specific object.
158+ * @param resultLimit The number of results to limit the request to.
159+ * @param maskString The mask, in string form, to use on the request.
160+ * @return String
161+ */
139162 protected String getFullUrl (String serviceName , String methodName , String id ,
140163 ResultLimit resultLimit , String maskString ) {
141164 StringBuilder url = new StringBuilder (baseUrl + serviceName );
@@ -146,9 +169,7 @@ protected String getFullUrl(String serviceName, String methodName, String id,
146169 // Some method names are not included, others can have the "get" stripped
147170 if (methodName .startsWith ("get" ) && !"getObject" .equals (methodName )) {
148171 url .append ('/' ).append (methodName .substring (3 ));
149- } else if (!"getObject" .equals (methodName ) && !"deleteObject" .equals (methodName ) &&
150- !"createObject" .equals (methodName ) && !"createObjects" .equals (methodName ) &&
151- !"editObject" .equals (methodName ) && !"editObjects" .equals (methodName )) {
172+ } else if (!IMPLICIT_SERVICE_METHODS .contains (methodName )) {
152173 url .append ('/' ).append (methodName );
153174 }
154175 url .append (".json" );
0 commit comments