Hi ,
I am writing Java code for calling ROR APIs ..
I have written Java code to get all the blogs by
public List<BlogBean> getBlogsXml() {
return webResource.path(ConfigurationUtil.LIST_BLOGS).header(ConfigurationUtil.AUTHENTICATION_HEADER, authentication)
.accept(MediaType.APPLICATION_XML_TYPE).get(new GenericType<List<BlogBean>>() {
});
}
where in my Configuration.Utilfile LIST_BLOGS will be http://localhost:3000/api/blogs.xml
now i trying to fetch the blogs that matches a field value for the blogs My blogs table contains a field slug so that those keyowrd that matches this will be returned.FOr this i received the input slug and now i need to append this slug with my path in the COnfigurationUTIL file LIST_BLOGS_SLUG = "http://localhost:3000/api/blogs/.xml"
how should i do this.. Below is my code for receiving the slug parameter
public List<BlogBean> showBlog_slug(String slug)
{
return webResource.path(ConfigurationUtil.LIST_BLOGS_SLUG).header(ConfigurationUtil.AUTHENTICATION_HEADER, authentication)
.accept(MediaType.APPLICATION_XML_TYPE).get(new GenericType<List<BlogBean>>() {
});
}
EDIT :
I have found the solution by myself by keeping the string in the method
public List showBlog_slug(String slug){ final string LIST_BLOGS_SLUG="mypath/api/blogs/"+slug+".xml" return webResource.path(LIST_BLOGS_SLUG).header(ConfigurationUtil.AUTHENTICATION_HEADER, authentication) .accept(MediaType.APPLICATION_XML_TYPE).get(new GenericType>() { }); }