Hi. According to fb docs,The only parameter is app_id, a String containing the ID of the application for which to install the tab. This call returns a String containing either true or false, dependind on the result of the operation.You can install a profile_tab at the end of the current list of installed tabs for a page by issuing an HTTP POST request to PAGE_ID/tabs with a Page Access Token.
I didn't find any method to do this in PageOperations, so I created a new one. It looks pretty much like post(String pageId, String message), except for the app_id parameter and the call to graphApi.publish(). The publish() method from GraphAPI checks for the "id" in the map returned by facebook and the post() method does not return anything, so I had to create a new method in GraphAPI to return the full result as a String. I called it add(), and implemented it in FacebookTemplate as follows.
Is this OK or am I reinventing something? My problem is solved, so I'm only asking because if it's OK, I should consider commiting these changes to the project.Code:public String add(String objectId, String connectionType, MultiValueMap<String, Object> data) { MultiValueMap<String, Object> requestData = new LinkedMultiValueMap<String, Object>(data); URI uri = URIBuilder.fromUri(GRAPH_API_URL + objectId + "/" + connectionType).build(); String response = getRestTemplate().postForObject(uri, requestData, String.class); return response; }
Thanks.


Reply With Quote
