@Override public Song getSongById(String songId) { Song song = restTemplate .getForObject(getApiResourceUrl("/" + songId), SongResponse.class) .getNestedResponse(); if (song.getTitle() == null) { throw new ResourceNotFoundException( "exfm", "No song details available for song id :" + songId); } return song; }
@Override public void loveSongBySourceUrl(String sourceUrl, String contextUrl, String fromUser) { requireAuthorization(); Song song = getSongBySourceUrl(sourceUrl); restTemplate.postForObject( getApiResourceUrl("/" + song.getId() + "/love") + (useOauth ? "" : ("?username="******"&password=" + password)) + getContextParamsString(contextUrl, fromUser, useOauth), null, String.class); }