Pages:
Author

Topic: [project] api.loyce.club: crowdsourcing Bitcointalk data - page 2. (Read 557 times)

hero member
Activity: 1540
Merit: 759
Have you install or/and configure MySQL? It's definitely required to build API services.

If we need simplicity, we could do it with only a table (which shown below).

Code:
CREATE TABLE MERIT (
    ID INT(11) PRIMARY KEY NOT NULL,
    QTY INT(2) NOT NULL,
    MSG VARCHAR(25) NOT NULL,
    SENDER INT(8) NOT NULL,
    RECEIVER INT(8) NOT NULL
);

Short demo (with MariaDB, but should be fully compatible with MySQL) :

Code:
MariaDB [test]> CREATE TABLE MERIT (
    ->     ID INT(11) PRIMARY KEY NOT NULL,
    ->     QTY INT(2) NOT NULL,
    ->     MSG VARCHAR(25) NOT NULL,
    ->     SENDER INT(8) NOT NULL,
    ->     RECEIVER INT(8) NOT NULL
    -> );
Query OK, 0 rows affected (0.029 sec)

MariaDB [test]> DESC MERIT;
+----------+-------------+------+-----+---------+-------+
| Field    | Type        | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| ID       | int(11)     | NO   | PRI | NULL    |       |
| QTY      | int(2)      | NO   |     | NULL    |       |
| MSG      | varchar(25) | NO   |     | NULL    |       |
| SENDER   | int(8)      | NO   |     | NULL    |       |
| RECEIVER | int(8)      | NO   |     | NULL    |       |
+----------+-------------+------+-----+---------+-------+
5 rows in set (0.001 sec)

MariaDB [test]> SELECT * FROM MERIT;
Empty set (0.000 sec)

MariaDB [test]> INSERT INTO MERIT VALUES (1561085310, 2, "178336.msg51543068", 452769, 239406);
Query OK, 1 row affected (0.008 sec)

MariaDB [test]> SELECT * FROM MERIT;
+------------+-----+--------------------+--------+----------+
| ID         | QTY | MSG                | SENDER | RECEIVER |
+------------+-----+--------------------+--------+----------+
| 1561085310 |   2 | 178336.msg51543068 | 452769 |   239406 |
+------------+-----+--------------------+--------+----------+
1 row in set (0.000 sec)

P.S. I learn SQL a bit, but i've no idea about MySQL security or performance.

It's not required to build the API service + the script CryptoNeed built simply just runs off the system Loyce has already built.

Quote
I think he is putting all the data together file by hand.

I'm assuming he uses a script to build it.
full member
Activity: 504
Merit: 137
Nope.
^ in that case, he will also need to log every merit transaction in the mysql database. It’s possible to make an API without an sql server.
Idk if Loyce knows mysql. But he already doesn’t know PHP, so that would just complicate his life. Cheesy
I’ll give a shot on making the API.

As far as I know he doesnt know SQL. I think he is putting all the data together file by hand.
It seems that Loyce did not have uploaded the adjusted the code as under the given URL it is responsing with the old version.


legendary
Activity: 2758
Merit: 6830
^ in that case, he will also need to log every merit transaction in the mysql database. It’s possible to make an API without an sql server.

Idk if Loyce knows mysql. But he already doesn’t know PHP, so that would just complicate his life. Cheesy

I’ll give a shot on making the API.

hero member
Activity: 1540
Merit: 759
Currently, I use http://api.loyce.club/crowdsourcing/ for testing. CryptoNeed's code is there, but I'm not sure how to use it.

I would expect this to work, but it doesn't:
http://api.loyce.club/crowdsourcing/meritjson.php?donor=459836

You have an error_log, feel free to shoot me a PM with the most recent error if you wish. I can take a look.

Try using the modified code I suggested in the other thread. I'm assuming you're running that as a linux server, so the code modification may be required.
full member
Activity: 504
Merit: 137
Nope.
Currently, I use http://api.loyce.club/crowdsourcing/ for testing. CryptoNeed's code is there, but I'm not sure how to use it.

I would expect this to work, but it doesn't:
http://api.loyce.club/crowdsourcing/meritjson.php?donor=459836

Not quite sure as it runs on my local servers without problems.
I noticed that the URL actually is http://api.loyce.club/crowdsourcing/merit.all.txt. Try to change the $url variable in the script. ($url = "merit.all.txt"; should be enough because script and source data is stored in the same directory).

I also want to credit Initscri. He is going to work on a combined version of this script.
Maybe we should add some error handling aswell.  Grin
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Currently, I use http://api.loyce.club/crowdsourcing/ for testing. CryptoNeed's code is there, but I'm not sure how to use it.

I would expect this to work, but it doesn't:
http://api.loyce.club/crowdsourcing/meritjson.php?donor=459836
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
In [BRAINSTORM] Any requests for custom extensions/user scripts for BitcoinTalk?, the suggestion for a Merit data API came up. User CryptoNeed made a PHP script, and to stop going off-topic there, I've created this topic.

api.loyce.club
I wouldn't know how to build an API, and have no experience with MySQL or PHP to store data. But I've collected a lot of data on Merit, Trust and bans (Nuke or Autoban) and wouldn't mind putting that to good use.

Join?
If anyone is interested in crowdsourcing additions, I'll be happy to host them. I would like it if any code contributions can be as free as possible, allowing anyone to build upon it and improve it. I won't be the best judge of all code, so I appreciate input on what's safe, efficient and worth using.

No spam
All my threads are now self-moderated to stop signature spam. I will remove all irrelevant posts. If you quote the entire OP, your entry will be deleted.
Pages:
Jump to: