RE: RE: HBIT resource credits
You are viewing a single comment's thread from:

RE: HBIT resource credits

Words
103
Reading
1 min
Listen
Play
1y

There is an old way and a new way to get an account's rep. The old way used getAccounts and the new uses bridge.get_profile. The old way returns 0 for me all the time. The new way returns a correct reputation. Here is some javascript:

            fetch('https://api.hive.blog', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({
                    jsonrpc: '2.0',
                    method: 'bridge.get_profile',
                    params: {
                        account: acct,
                        observer: acct,
                    },
                    id: 1,
                }),
            })
                .then(response => response.json())
                .then(data => {
                    // Handle the response data here
                    console.log(data.result.reputation);
                })
                .catch(error => {
                    // Handle any errors
                    console.error('Error:', error);
                });

Any questions, just ask. Hope this helps! :)

@kenny-crane: There is an old | Ecency