'Next of paging is not working, in instagram API call

I am using the below given URL for GET request -

https://graph.facebook.com/INSTAGRAM_MEDIA_ID?fields=comments{text,timestamp,replies}&access_token=USER_ACCESS_TOKEN

The data it returns contains a next cursor, which looks like this

https://graph.facebook.com/v13.0/INSTAGRAM_MEDIA_ID/comments?access_token=USER_ACCESS_TOKEN&pretty=1&fields=text\u00252Ctimestamp\u00252Creplies&limit=25&after=AFTER_TOKEN

When I do GET request on the above URL, It returns this error.

{
   "error": {
      "message": "Syntax error \"Expected end of string instead of \"\\\".\" at character 4: text\\u00252Ctimestamp\\u00252Creplies",
      "type": "OAuthException",
      "code": 2500,
      "fbtrace_id": "FB_TRACE_ID"
   }
}

If I do a normal request like

https://graph.facebook.com/INSTAGRAM_MEDIA_ID/comments?access_token=USER_ACCESS_TOKEN

It also returns data that contains next URL, which is working fine.

The post one which I am doing this request has more than 25 comments hence I need to use next URL here.

The normal request(non nested one) doesn't return replies on comments, but I need to see replies too, that's why I am doing a nested request.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source