Bitcoin Forum

Bitcoin => Project Development => Topic started by: lulucrypto on November 16, 2019, 12:56:50 PM



Title: Trusts API.
Post by: lulucrypto on November 16, 2019, 12:56:50 PM
Hello,

Today I present to you my new project.

This project is developed following this topic :
- https://bitcointalk.org/index.php?topic=5157603.msg53074017#msg53074017

The purpose of the project is quite simple, to provide an API that retrieves trusts information from a profile.

At first, go here and follow the README instructions :
- https://github.com/luluwebmaster/bitcointalk-api-trusts

Once the project is properly installed and configured, the API is very easy to use.

For example, if you want to get the trusts data of a user in JSON :
- Call : https://api.example.com/trusts/public/api.php?clientId=1305990

This request will return :
Code:
{"warning":false,"username":"lulucrypto","trusts":["+0","=1","-0"]}

This is for those who wish to use this data in structured form.

It is also possible to display the image corresponding to a user simply by using this code :
Code:
[img alt=Trust score loading...]https://api.example.com/trusts/public/image.php?clientId=1305990[/img]

With this url, you will directly see the image corresponding to the profile like this :

https://trusts.bitcointalk.luc-mergault.fr/trusts.png?profileId=1305990

You can test the API here :
- Json : https://trusts.bitcointalk.luc-mergault.fr/trusts.json?profileId=1305990
- Image : https://trusts.bitcointalk.luc-mergault.fr/trusts.png?profileId=1305990

And, that's all !

Now, there is more to install the script and test ! :)


Title: Re: Trusts API.
Post by: hatshepsut93 on November 16, 2019, 03:26:46 PM
Are you planning to host your API somewhere? API's usually make most sense when they are provided by a third party, so that they can be called from client's side or by other servers. There are even some good free options like Heroku.

Also, you should write the documentation for your API - all the routes, what params they expect and what type of data they return.


Title: Re: Trusts API.
Post by: lulucrypto on November 16, 2019, 04:34:42 PM
Are you planning to host your API somewhere? API's usually make most sense when they are provided by a third party, so that they can be called from client's side or by other servers. There are even some good free options like Heroku.

Also, you should write the documentation for your API - all the routes, what params they expect and what type of data they return.

Basically this idea of project is not mine, I simply automated the process of @LoyceV (https://bitcointalk.org/index.php?action=profile;u=459836) with his project (https://bitcointalk.org/index.php?topic=5200499.msg53046041#msg53046041).

If he agrees that I offer the API on my domain, I would agree to do so.

The basic idea is that it is him who proposes the API ( To bind it with his project of API (https://bitcointalk.org/index.php?topic=5157603.msg51573947#msg51573947) ) ;)

Edit :

Also, you should write the documentation for your API - all the routes, what params they expect and what type of data they return.

For that, it will come soon, but I am not very good to do this kind of thing :P


Title: Re: Trusts API.
Post by: LoyceV on November 17, 2019, 02:09:58 PM
Just to let you know: I've seen your topic, but haven't had the time to test/install your work yet.


Title: Re: Trusts API.
Post by: lulucrypto on November 17, 2019, 02:16:52 PM
Just to let you know: I've seen your topic, but haven't had the time to test/install your work yet.

Hello,

Oh, ok, excuse me, I did not know ^^

Keep me informed when you install the script.

It's possible that it needs to configure some stuff on your Apache server for the project to work properly.

( I still have to add details to the project's README file. )


Title: Re: Trusts API.
Post by: LoyceV on November 19, 2019, 06:34:12 PM
If he agrees that I offer the API on my domain, I would agree to do so.
Sorry for taking this long to respond, I wanted to install this, but I don't really have the time. And considering I know nothing about the things I'll be doing, while I already have my Trust score images (https://bitcointalk.org/index.php?topic=5200499.0) working, I don't want to spend a lot of time on this. It's much easier and no doubt faster if you just install it on your own domain.

I tried to make my images look as natural as possible:
http://loyce.club/trust/images/874254.gif (https://bitcointalk.org/index.php?topic=5200499.0)
http://loyce.club/trust/images/2607952.gif (https://bitcointalk.org/index.php?topic=5200499.0)
http://loyce.club/trust/images/538922.gif (https://bitcointalk.org/index.php?topic=5200499.0)
http://loyce.club/trust/images/3.gif (https://bitcointalk.org/index.php?topic=5200499.0)


Title: Re: Trusts API.
Post by: lulucrypto on November 19, 2019, 09:19:13 PM
Sorry for taking this long to respond, I wanted to install this, but I don't really have the time. And considering I know nothing about the things I'll be doing, while I already have my Trust score images (https://bitcointalk.org/index.php?topic=5200499.0) working, I don't want to spend a lot of time on this. It's much easier and no doubt faster if you just install it on your own domain.

Yes no worries, I understand.

So I installed the script on this domain :
- https://trusts.bitcointalk.luc-mergault.fr/

It is therefore possible to recover the trusts in JSON format :
- https://trusts.bitcointalk.luc-mergault.fr/trusts.json?profileId=1305990

And directly in an image :
- https://trusts.bitcointalk.luc-mergault.fr/trusts.png?profileId=1305990

I will see to update the topic according to my domain :D


Title: Re: Trusts API.
Post by: LoyceV on November 19, 2019, 09:21:59 PM
Test:
https://trusts.bitcointalk.luc-mergault.fr/trusts.png?profileId=459836

This is easier indeed! It just looks less good than this:
http://loyce.club/trust/images/459836.gif (https://bitcointalk.org/index.php?topic=5200499.0)


Title: Re: Trusts API.
Post by: lulucrypto on November 19, 2019, 09:28:38 PM
Everything is relative ha ha :P

Personally I prefer the model a little arranged ^^

After, if it's only that that bothers you, it's not difficult to provide an alternative to display the images as yours ;)


Title: Re: Trusts API.
Post by: LoyceV on November 20, 2019, 06:42:51 PM
I'm bringing your post from another topic here:
As I said on the other subject, if it is possible, I would know the part that generates the images ( In private message if necessary ) :)
My guess would be he uses (something like) ImageMagick. It's very powerful on the command line, and there's a PHP version (of which I have no idea how it works).


Title: Re: Trusts API.
Post by: lulucrypto on November 20, 2019, 08:55:52 PM
Hum, maybe :D

After so far, I thought he was using PHP Basic :
- https://www.php.net/manual/en/ref.image.php

That's what I used personally, but I would have liked to see how he uses all that :P