private String getPayload() { Map<String, Object> payload = ImmutableMap.<String, Object>of( "articleId", data.getArticleId(), "checksum", buildChecksum(), "collectionMeta", buildCollectionMetaToken()); return LivefyreUtil.mapToJsonString(payload); }
/** * Retrieves this collection's information from Livefyre. Makes an external API call. * * @return JSONObject. */ public JsonObject getCollectionContent() { String b64articleId = Base64Url.encode(data.getArticleId().getBytes()); if (b64articleId.length() % 4 != 0) { b64articleId = b64articleId + StringUtils.repeat("=", 4 - (b64articleId.length() % 4)); } String url = String.format( "%s/bs3/%s.fyre.co/%s/%s/init", Domain.bootstrap(this), site.getNetwork().getNetworkName(), site.getData().getId(), b64articleId); ClientResponse response = Client.create().resource(url).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); if (response.getStatus() >= 400) { throw new ApiException(response.getStatus()); } Gson gson = new Gson(); return gson.fromJson(response.getEntity(String.class), JsonObject.class); }