Webservice Connector - Create Account Operation - Empty Response

Something along the lines of this should is what I was talking about:

import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.text.ParseException;

Map updatedMapInfo = new HashMap();
List finalList = new ArrayList();
Map body = requestEndPoint.getBody();
String jsonBody = (String) body.get("jsonBody");

Map jsonMap = JsonUtil.toMap(jsonBody);
if (jsonMap != null) {
    for (int i = 0; i < processedResponseObject.size(); i++) {
        Map responseMap = (Map) processedResponseObject.get(i);

        // Get Login from requestEndpoint
        String login = (String) jsonMap.get("login");

        // Get ID
        List allowedStatuses = requestEndPoint.getResponseCode();
        Map header = requestEndPoint.getHeader();
        String fullUrl = requestEndPoint.getFullUrl(); // Can change the URL to what the filter is.
        String createdAccountFiltered = restClient.executeGet(fullUrl + "?login=" + login, header, allowedStatuses);
        Map createdAccountMap = JsonUtil.toMap(createdAccountFiltered);
        String accountId = createdAccountMap.get("id");

        // Add info to response
        responseMap.put("id", accountId);
        responseMap.put("login", login);
        responseMap.put("<some-attribute>", jsonMap.get("<some-attribute>"));

        finalList.add(responseMap);
    }

    updatedMapInfo.put("data", finalList);
}

return updatedMapInfo;

Don’t forget to add try/catch for exceptions and to add additional logging for debugging. You can catch the log statements by turning on CCG debug logging for the connector and viewing the ccg.log file on the VA.

2 Likes