Product API implementation into the PHP Client for Makerlog by dehenne

View this thread on steempeak.com
· @dehenne ·
$42.33
Product API implementation into the PHP Client for Makerlog
Product API implementation into the PHP Client for Makerlog
======

As already mentioned in the last posts, I develop the PHP client for Makerlog in my spare time. Makerlog is the dead-simple task log that helps you stay productive and ship faster. There you can meet other makers and share your progress.

The last days I finished the Product API and integrated an undocumented search of tasks.

#### Repository

- https://github.com/pcsg/pcsg-makerlog-php-client
- Licence: GPL-3.0+


### New Features

#### What feature(s) did you add?

- I implemented the product API.
- `/products/ GET, POST
- `/products/{slug}/` GET, PATCH, DELETE
- `/products/{slug}/leave/`
- `/products/{slug}/people/`
- `/products/{slug}/projects/`
- `/products/{slug}/stats/`
- I implemented the tasks search API
- `/search/tasks/?q=`

#### How did you implement it/them?

The implementation is done with the following commits

**Products**

- [f958c8a](https://github.com/pcsg/pcsg-makerlog-php-client/commit/f958c8a140c92c66af3f43f448cd5878523aab0b)
- [47452cb](https://github.com/pcsg/pcsg-makerlog-php-client/commit/47452cb0fe7675baab284a5771dc79d6c7ac0391)
- [2b26022](https://github.com/pcsg/pcsg-makerlog-php-client/commit/2b26022d5837a58074b2e2d126da9afbe835dcc1)
- [a7e17c7](https://github.com/pcsg/pcsg-makerlog-php-client/commit/a7e17c7351fd5144e41c393bbb20e0bfd2eabaf4)
- [77a3fef](https://github.com/pcsg/pcsg-makerlog-php-client/commit/77a3fef7974f1480b31cdfe0edb8e25f7a62f3d6)

**Task Search**

- [b9b1793](https://github.com/pcsg/pcsg-makerlog-php-client/commit/b9b1793519df4082f46aaf496b8ee9457504e6b0)
- [fcafbd4](https://github.com/pcsg/pcsg-makerlog-php-client/commit/fcafbd4b444e9e9c9f34bf4bec5659e5812139cd)

Like in the last posts, I will go into the API a little bit. The complete API documentation is available under: https://github.com/pcsg/pcsg-makerlog-php-client/blob/master/docs/products.md

##### Products

The first thing you want to do, of course, is create a product. You have to know that some things are necessary for a product. For example, every product must have a project. Since I found this very annoying at the product creation, I automated the creation of an associated project.

Of course you can also create a project yourself and assign it to the product, that's no problem.

The easiest way to create a product is the following way:

![1.png](https://cdn.steemitimages.com/DQmeQgWbjQTomn4j5u3CPdKio34rwa6CPN3k2V7dvSzteSg/1.png)

*This example creates a product and the first project is created from the name of the product.*

However, if you want to create a product and already have a project, you can also pass this on.

![2.png](https://cdn.steemitimages.com/DQmTkrybiXub6QEagynJusHinNqqA7V4vjEgufp7uRGnUed/2.png)

In the complete API I have tried to ensure continuity. Therefore the getting of a product is as easy as the getting of a task or a project.

![3.png](https://cdn.steemitimages.com/DQmVLKiLMg8iibT5T3BUZi3mKcFkK1fLKnzJHBmtA8rbSKb/3.png)

One of the most beautiful features that have been added to Makerlog in the last weeks is the team building. It is now possible to assign other users to your product since one or two weeks. With the API client this is very easy to implement.

![4.png](https://cdn.steemitimages.com/DQmUhNzCzsEaB1UHY6XsXyDuVHmHUCC1JYqyns3jWpPyyZi/4.png)

If you want to work with the product or to read different data from it, you should take a look at all the getter methods. 

![5.png](https://cdn.steemitimages.com/DQmPhrQaJFux3A1NafFQwGze9ZBJU42cpdKcMzELK4ryjZY/5.png)

##### Task search

As a little goodie, I got a task request if I can integrate the task search API. This API is not documented but the basic usage is now built in.  I don't know if there are other parameters at the moment, but this will be clarified in the next days.

![6.png](https://cdn.steemitimages.com/DQmZi3nxvk2cWpmptpiq8KWUwmc2uyYHb9yfu1wQKWX5rAM/6.png)

#### GitHub Account

- https://github.com/dehenne


##### Future

The goal for the first version is next week at the latest. For version 1.0 the user API is still missing, which I have to check  but it is 50% ready and should be usable in the next days. After that I will introduce a dozen php unit tests to make the client stable.

That was it for today already, I hope I could give a little insight into the PHP client of Makerlog.

Have fun in [Makerlog](https://getmakerlog.com/) and thanks for reading,
Hen
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 90 others
properties (23)
post_id71,759,489
authordehenne
permlinkproduct-api-implementation-into-the-php-client-for-makerlog
categoryutopian-io
json_metadata{"tags":["utopian-io","development"],"image":["https:\/\/cdn.steemitimages.com\/DQmeQgWbjQTomn4j5u3CPdKio34rwa6CPN3k2V7dvSzteSg\/1.png","https:\/\/cdn.steemitimages.com\/DQmTkrybiXub6QEagynJusHinNqqA7V4vjEgufp7uRGnUed\/2.png","https:\/\/cdn.steemitimages.com\/DQmVLKiLMg8iibT5T3BUZi3mKcFkK1fLKnzJHBmtA8rbSKb\/3.png","https:\/\/cdn.steemitimages.com\/DQmUhNzCzsEaB1UHY6XsXyDuVHmHUCC1JYqyns3jWpPyyZi\/4.png","https:\/\/cdn.steemitimages.com\/DQmPhrQaJFux3A1NafFQwGze9ZBJU42cpdKcMzELK4ryjZY\/5.png","https:\/\/cdn.steemitimages.com\/DQmZi3nxvk2cWpmptpiq8KWUwmc2uyYHb9yfu1wQKWX5rAM\/6.png"],"links":["https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/f958c8a140c92c66af3f43f448cd5878523aab0b","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/47452cb0fe7675baab284a5771dc79d6c7ac0391","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/2b26022d5837a58074b2e2d126da9afbe835dcc1","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/a7e17c7351fd5144e41c393bbb20e0bfd2eabaf4","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/77a3fef7974f1480b31cdfe0edb8e25f7a62f3d6","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/b9b1793519df4082f46aaf496b8ee9457504e6b0","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/fcafbd4b444e9e9c9f34bf4bec5659e5812139cd","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/blob\/master\/docs\/products.md","https:\/\/github.com\/dehenne","https:\/\/getmakerlog.com\/"],"app":"steemit\/0.1","format":"markdown"}
created2019-03-20 17:43:12
last_update2019-03-20 17:43:12
depth0
children6
net_rshares64,755,282,365,728
last_payout2019-03-27 17:43:12
cashout_time1969-12-31 23:59:59
total_payout_value32.220 SBD
curator_payout_value10.114 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length4,410
author_reputation8,024,988,975,286
root_title"Product API implementation into the PHP Client for Makerlog"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (154)
@steemitboard ·
Congratulations @dehenne! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td>https://steemitimages.com/60x70/http://steemitboard.com/@dehenne/posts.png?201903201847</td><td>You published more than 40 posts. Your next target is to reach 50 posts.</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@dehenne) and compare to others on the [Steem Ranking](http://steemitboard.com/ranking/index.php?name=dehenne)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/carnival/@steemitboard/carnival-challenge-here-are-the-winners"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/rltzHT.png"></a></td><td><a href="https://steemit.com/carnival/@steemitboard/carnival-challenge-here-are-the-winners">Carnival Challenge - Here are the winners</a></td></tr></table>

###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
post_id71,763,784
authorsteemitboard
permlinksteemitboard-notify-dehenne-20190320t195453000z
categoryutopian-io
json_metadata{"image":["https:\/\/steemitboard.com\/img\/notify.png"]}
created2019-03-20 19:54:51
last_update2019-03-20 19:54:51
depth1
children0
net_rshares0
last_payout2019-03-27 19:54:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,278
author_reputation38,705,954,145,809
root_title"Product API implementation into the PHP Client for Makerlog"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@justyy ·
$10.20
Thank you for your contribution. You probably want to take a look at [Rest API Design](https://www.mulesoft.com/resources/api/what-is-rest-api-design).

1. [this line](https://github.com/pcsg/pcsg-makerlog-php-client/commit/47452cb0fe7675baab284a5771dc79d6c7ac0391#diff-f0c722a0daf1037815467c8e1c129611R11) seems duplicate.
2. Your `getProductData` has been called in its many APIs to get the sub-field which may be cached.
3. The `getData` and many other APIs has a long chain in getting its field data, which may throw exception e.g. null pointer. The try-catch will hide the errors and prevent early identification of the risks - which is generally a bad idea.
4. When performing `addUserToTheTeam`, have you thought about multiple requests i.e. race conditions?

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/2-2-2-2-2-2-1-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id71,767,929
authorjustyy
permlinkre-dehenne-product-api-implementation-into-the-php-client-for-makerlog-20190320t220927116z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https:\/\/www.mulesoft.com\/resources\/api\/what-is-rest-api-design","https:\/\/github.com\/pcsg\/pcsg-makerlog-php-client\/commit\/47452cb0fe7675baab284a5771dc79d6c7ac0391#diff-f0c722a0daf1037815467c8e1c129611R11","https:\/\/join.utopian.io\/guidelines","https:\/\/review.utopian.io\/result\/3\/2-2-2-2-2-2-1-","https:\/\/discord.gg\/uTyJkNm","https:\/\/join.utopian.io\/"],"app":"steemit\/0.1"}
created2019-03-20 22:09:30
last_update2019-03-20 22:09:30
depth1
children1
net_rshares15,694,498,694,430
last_payout2019-03-27 22:09:30
cashout_time1969-12-31 23:59:59
total_payout_value7.740 SBD
curator_payout_value2.463 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,215
author_reputation2,046,968,271,807,515
root_title"Product API implementation into the PHP Client for Makerlog"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (21)
@utopian-io ·
Thank you for your review, @justyy! Keep up the good work!
properties (22)
post_id71,912,272
authorutopian-io
permlinkre-re-dehenne-product-api-implementation-into-the-php-client-for-makerlog-20190320t220927116z-20190323t122258z
categoryutopian-io
json_metadata{"app":"beem\/0.20.17"}
created2019-03-23 12:23:00
last_update2019-03-23 12:23:00
depth2
children0
net_rshares0
last_payout2019-03-30 12:23:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length58
author_reputation152,913,012,544,965
root_title"Product API implementation into the PHP Client for Makerlog"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steem-ua ·
#### Hi @dehenne!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
post_id71,768,189
authorsteem-ua
permlinkre-product-api-implementation-into-the-php-client-for-makerlog-20190320t221812z
categoryutopian-io
json_metadata{"app":"beem\/0.20.18"}
created2019-03-20 22:18:12
last_update2019-03-20 22:18:12
depth1
children0
net_rshares0
last_payout2019-03-27 22:18:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length286
author_reputation23,203,609,903,979
root_title"Product API implementation into the PHP Client for Makerlog"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
Hey, @dehenne!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
post_id71,912,365
authorutopian-io
permlinkre-product-api-implementation-into-the-php-client-for-makerlog-20190323t122526z
categoryutopian-io
json_metadata{"app":"beem\/0.20.17"}
created2019-03-23 12:25:27
last_update2019-03-23 12:25:27
depth1
children0
net_rshares0
last_payout2019-03-30 12:25:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length589
author_reputation152,913,012,544,965
root_title"Product API implementation into the PHP Client for Makerlog"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@steemitboard ·
Congratulations @dehenne! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/https://steemitboard.com/@dehenne/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@dehenne) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=dehenne)_</sub>


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
post_id75,882,219
authorsteemitboard
permlinksteemitboard-notify-dehenne-20190605t063026000z
categoryutopian-io
json_metadata{"image":["https:\/\/steemitboard.com\/img\/notify.png"]}
created2019-06-05 06:30:27
last_update2019-06-05 06:30:27
depth1
children0
net_rshares0
last_payout2019-06-12 06:30:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length617
author_reputation38,705,954,145,809
root_title"Product API implementation into the PHP Client for Makerlog"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000