Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not returning response #6

Closed
grunt2001c opened this issue Mar 17, 2022 · 2 comments
Closed

not returning response #6

grunt2001c opened this issue Mar 17, 2022 · 2 comments

Comments

@grunt2001c
Copy link

I'm trying to get posts from wordpress and i'm not getting response back. i'm running latest version of the library. Am i missing something? Sorry still learning flutter.
Future<ResponseContainer<List<Post?>?>> getPosts() async { WordpressClient client; client = new WordpressClient('https://{obfiscatedurl}/wp-json', 'wp/v2'); ResponseContainer<List<Post?>?> posts = await client.posts .list((builder) => builder.withPerPage(20).withPageNumber(1).build()); print(posts.value!.first!.id); return posts; }

@ArunPrakashG
Copy link
Owner

Hey there!

I am having trouble understanding the issue.
The request code is correct. I am guessing there is either some exception being thrown internally or your Wordpress api isn't responding with valid data. (An array of posts in this case.)

Few methods which will help you with identifying the actual problem:

  • Use postman to manually send a GET Request to Wordpress post list endpoint. https://www.replaceme.com/wp-json/wp/v2/posts or better yet, simply copy paste this url into your browser address bar. (After replacing replaceme.com with your domain ofc)
  • Register Response/Request callbacks which is available to you during building process of a request.
  • Add Response preprocessor to get the raw response which is returned from the server.

Thank you!

@ArunPrakashG
Copy link
Owner

Closing this as there hasn't been any activity on the topic sine the last comment.

Please open this again or create a new issue if you are facing this again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants