I have a Persian wordpress site, now I want to get its data in the JSON format and shown on a android application, how can I do it with the Persian language?
SITE_URL/wp-json/wp/v2/posts/
or
SITE_URL/wp-json/wp/v2/posts/?page=1
I've used these 2 methods but none of them work, and the news part in the application is empty but the category is shown!
public interface ApiService {
String BaseURL= "https://irantopbet.net/";
/*category() used for fetch main category list*/
@GET("wp-json/wp/v2/categories?per_page=100")
Call<JsonElement> category();
/*getFeatureNews() used for featuresnews list*/
@GET("wp-json/wp/v2/posts")
Call<JsonElement> getFeatureNews();
/*contactus used for add contact details */
@FormUrlEncoded
@POST("api/contact_us.php")
Call<JsonElement> contactus(@Field("name") String name, @Field("email") String email, @Field("message") String message);
/*getNewsByCatID used for fetch news using category id*/
@GET("wp-json/wp/v2/posts?")
Call<JsonElement> getNewsByCatID(@Query("categories") String catID);
/*search used for search all project content*/
@GET("wp-json/wp/v2/posts/?")
Call<JsonElement> search(@Query("search") String world);
/*getNewsByNewsID used for get news detais*/
@GET("wp-json/wp/v2/posts/{NewsId}")
Call<JsonElement> getNewsByNewsID(@Path("NewsId") String newsID);
/*getAllComment used for view all comments*/
@GET("wp-json/wp/v2/comments")
Call<JsonElement> getAllComment(@Query("post") String postId);
/*addComment used for add comment in news details*/
@FormUrlEncoded
@POST("api/comment.php")
Call<JsonElement> addComment(@Field("post_id") String postId,
@Field("comment_author") String commentAuthor,
@Field("comment_author_email") String commentAuthorEmail,
@Field("comment_content") String commentContent,
@Field("user_id") String userId);
/*getAllLatestNews used for all latest news list*/
@GET("wp-json/wp/v2/posts?")
Call<JsonElement> getAllLatestNews(@Query("categories") String
catID,@Query("page") int per_page);
}
https://irantopbet.net/wp-json/wp/v2/categories?per_page=100 this works and the category is shown in the application
But https://irantopbet.net/wp-json/wp/v2/posts when opening this link there is something on it but nothing is shown in the application