I using REST api v2 and its respond is about 1MB for one request (10 items) and it takes about 6 ~ 11 seconds that very bad. In my web site there is long articles that written in Persian that stored uni-code so there is many characters for respond. I want to make its performance better. I do some permomance stuff for example:

  • removed _embed from main request that leads to smaller response (about 800K) and better time 5 ~ 9 secs and then make another request to get images url from resourceId (featured_media field) and then load that Url to ImageView with Glide.

  • Cache all received images by featured_media id field that makes loading image go faster. I don't want cache web post contents and need app to be fresh.

But it seems that till i do not get-rid of unneeded fields in response nothing change dramatically and it makes scene. Why should get un-needed fields in respond? so how i can modify request responses? I wanna remove un-needed fields or customize them or for example Add ImageUrl instead of featured_media that contains Id.

  • Sounds like you're looking for a custom endpoint. Usually not recommended to remove from existing ones. Why is it so large for only 10 items? – birgire Apr 11 '18 at 16:49
  • You should not have an performance issue for 10 items. But you can filter the data, however the impact is to less. Maybe you should debug you install, server landscape for this respond or you should add a object cache. – bueltge Apr 11 '18 at 18:46
  • @birgire cause my website is in Perian( Unicode) and most of articles are long one. So one request takes about 6 - 11 seconds. I updated the question for more detail. So how end points works? is there any tutorial? – Kenji Apr 13 '18 at 4:41
  • @bueltge I updated the question, and mention that I need to not cache pots contents. thanks – Kenji Apr 13 '18 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.