You are viewing a single comment's thread from:

RE: Upcoming Changes to api.steemit.com

in #steemit6 years ago

How can I keep using the discussion queries in Steem.JS like steem.api.getDiscussionsByBlog() or steem.api.getDiscussionsByTrending()?

When I try these functions on api.steemitdev.com I get this error: RPCError: Server error.

Sort:  

Hi @penguinpablo, could you share the exact request? Working to get better error details exposed from the server but the most common cause is omitting some arguments.

Hi @roadscape! Thanks for your response.
Here's the Javascript code:

steem.api.setOptions({url:'https://api.steemitdev.com'});
steem.api.getDiscussionsByBlog({tag:'penguinpablo',limit:1}, function(err, result) {
 console.log(err);
});

Results in:

RPCError: Server error

It works using api.steemit.com, but not on api.steemitdev.com.

What if you specify "useAppbaseApi": true in the config?

I tried

steem.api.setOptions({url:'https://api.steemitdev.com', useAppbaseApi:true});

...But unfortunately the same error.

Ok I believe this is due to (1) using the legacy call format, combined with (2) not specifying start_author and start_permlink. If you include both of those keys and set them to blank, it should work. Please confirm that this solves the problem and we'll loosen the call format restriction.

That nailed it, thank you!
And we don't even need to set the useAppbaseApi: true option

👍I've gone ahead and made those two parameters optional again since a lot of calls seem to be omitting them. Also the API will be returning more helpful error messages now.

Thanks a lot! It works now :)

hey @roadscape,
facing same issue as reported by @penguinpablo, my function call is about discussions by created though.
I tried both steemjs (steem.api.getDiscussionsByCreated(query, async function (err, result)) and dsteem (client.database.getDiscussions('created', query)), both returning server errors when tested on https://api.steemitdev.com, while they work properly on https://api.steemit.com
useAppbaseApi did not solve it either for steemjs
Thoughts?

See reply above and let me know if it helps.

It's a steem-js issue, possibly pulling older version.