Product API implementation into the PHP Client for Makerlog

in #utopian-io6 years ago

Product API implementation into the PHP Client for Makerlog

<p dir="auto">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. <p dir="auto">The last days I finished the Product API and integrated an undocumented search of tasks. <h4>Repository <ul> <li><span><a href="https://github.com/pcsg/pcsg-makerlog-php-client" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/pcsg/pcsg-makerlog-php-client <li>Licence: GPL-3.0+ <h3>New Features <h4>What feature(s) did you add? <ul> <li>I implemented the product API. <li>`/products/ GET, POST <li><code>/products/{slug}/ GET, PATCH, DELETE <li><code>/products/{slug}/leave/ <li><code>/products/{slug}/people/ <li><code>/products/{slug}/projects/ <li><code>/products/{slug}/stats/ <li>I implemented the tasks search API <li><code>/search/tasks/?q= <h4>How did you implement it/them? <p dir="auto">The implementation is done with the following commits <p dir="auto"><strong>Products <ul> <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/f958c8a140c92c66af3f43f448cd5878523aab0b" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">f958c8a <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/47452cb0fe7675baab284a5771dc79d6c7ac0391" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">47452cb <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/2b26022d5837a58074b2e2d126da9afbe835dcc1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">2b26022 <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/a7e17c7351fd5144e41c393bbb20e0bfd2eabaf4" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">a7e17c7 <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/77a3fef7974f1480b31cdfe0edb8e25f7a62f3d6" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">77a3fef <p dir="auto"><strong>Task Search <ul> <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/b9b1793519df4082f46aaf496b8ee9457504e6b0" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">b9b1793 <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/fcafbd4b444e9e9c9f34bf4bec5659e5812139cd" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">fcafbd4 <p dir="auto"><span>Like in the last posts, I will go into the API a little bit. The complete API documentation is available under: <a href="https://github.com/pcsg/pcsg-makerlog-php-client/blob/master/docs/products.md" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/pcsg/pcsg-makerlog-php-client/blob/master/docs/products.md <h5>Products <p dir="auto">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. <p dir="auto">Of course you can also create a project yourself and assign it to the product, that's no problem. <p dir="auto">The easiest way to create a product is the following way: <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmeQgWbjQTomn4j5u3CPdKio34rwa6CPN3k2V7dvSzteSg/1.png" alt="1.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmeQgWbjQTomn4j5u3CPdKio34rwa6CPN3k2V7dvSzteSg/1.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmeQgWbjQTomn4j5u3CPdKio34rwa6CPN3k2V7dvSzteSg/1.png 2x" /> <p dir="auto"><em>This example creates a product and the first project is created from the name of the product. <p dir="auto">However, if you want to create a product and already have a project, you can also pass this on. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmTkrybiXub6QEagynJusHinNqqA7V4vjEgufp7uRGnUed/2.png" alt="2.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmTkrybiXub6QEagynJusHinNqqA7V4vjEgufp7uRGnUed/2.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmTkrybiXub6QEagynJusHinNqqA7V4vjEgufp7uRGnUed/2.png 2x" /> <p dir="auto">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. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmVLKiLMg8iibT5T3BUZi3mKcFkK1fLKnzJHBmtA8rbSKb/3.png" alt="3.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmVLKiLMg8iibT5T3BUZi3mKcFkK1fLKnzJHBmtA8rbSKb/3.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmVLKiLMg8iibT5T3BUZi3mKcFkK1fLKnzJHBmtA8rbSKb/3.png 2x" /> <p dir="auto">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. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmUhNzCzsEaB1UHY6XsXyDuVHmHUCC1JYqyns3jWpPyyZi/4.png" alt="4.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmUhNzCzsEaB1UHY6XsXyDuVHmHUCC1JYqyns3jWpPyyZi/4.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmUhNzCzsEaB1UHY6XsXyDuVHmHUCC1JYqyns3jWpPyyZi/4.png 2x" /> <p dir="auto">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. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmPhrQaJFux3A1NafFQwGze9ZBJU42cpdKcMzELK4ryjZY/5.png" alt="5.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmPhrQaJFux3A1NafFQwGze9ZBJU42cpdKcMzELK4ryjZY/5.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmPhrQaJFux3A1NafFQwGze9ZBJU42cpdKcMzELK4ryjZY/5.png 2x" /> <h5>Task search <p dir="auto">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. <p dir="auto"><img src="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmZi3nxvk2cWpmptpiq8KWUwmc2uyYHb9yfu1wQKWX5rAM/6.png" alt="6.png" srcset="https://images.hive.blog/768x0/https://cdn.steemitimages.com/DQmZi3nxvk2cWpmptpiq8KWUwmc2uyYHb9yfu1wQKWX5rAM/6.png 1x, https://images.hive.blog/1536x0/https://cdn.steemitimages.com/DQmZi3nxvk2cWpmptpiq8KWUwmc2uyYHb9yfu1wQKWX5rAM/6.png 2x" /> <h4>GitHub Account <ul> <li><span><a href="https://github.com/dehenne" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://github.com/dehenne <h5>Future <p dir="auto">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. <p dir="auto">That was it for today already, I hope I could give a little insight into the PHP client of Makerlog. <p dir="auto">Have fun in <a href="https://getmakerlog.com/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Makerlog and thanks for reading,<br /> Hen
Sort:  

Thank you for your contribution. You probably want to take a look at Rest API Design.

<ol> <li><a href="https://github.com/pcsg/pcsg-makerlog-php-client/commit/47452cb0fe7675baab284a5771dc79d6c7ac0391#diff-f0c722a0daf1037815467c8e1c129611R11" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">this line seems duplicate. <li>Your <code>getProductData has been called in its many APIs to get the sub-field which may be cached. <li>The <code>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. <li>When performing <code>addUserToTheTeam, have you thought about multiple requests i.e. race conditions? <p dir="auto">Your contribution has been evaluated according to <a href="https://join.utopian.io/guidelines" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category. <p dir="auto">To view those questions and the relevant answers related to your post, <a href="https://review.utopian.io/result/3/2-2-2-2-2-2-1-" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">click here. <hr /> <p dir="auto">Need help? Chat with us on <a href="https://discord.gg/uTyJkNm" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Discord. <p dir="auto"><a href="https://join.utopian.io/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">[utopian-moderator]

Thank you for your review, @justyy! Keep up the good work!

Congratulations @dehenne! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><span><img src="https://images.hive.blog/768x0/https://steemitimages.com/60x70/http://steemitboard.com/@dehenne/posts.png?201903201847" srcset="https://images.hive.blog/768x0/https://steemitimages.com/60x70/http://steemitboard.com/@dehenne/posts.png?201903201847 1x, https://images.hive.blog/1536x0/https://steemitimages.com/60x70/http://steemitboard.com/@dehenne/posts.png?201903201847 2x" /><td>You published more than 40 posts. Your next target is to reach 50 posts. <p dir="auto"><sub><em>You can view <a href="https://steemitboard.com/@dehenne" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">your badges on your Steem Board and compare to others on the <a href="http://steemitboard.com/ranking/index.php?name=dehenne" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Steem Ranking<br /> <sub><em>If you no longer want to receive notifications, reply to this comment with the word <code>STOP <p dir="auto">To support your work, I also upvoted your post! <p dir="auto"><strong><span>Do not miss the last post from <a href="/@steemitboard">@steemitboard: <table><tr><td><a href="https://steemit.com/carnival/@steemitboard/carnival-challenge-here-are-the-winners" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link"><img src="https://images.hive.blog/768x0/https://steemitimages.com/64x128/http://i.cubeupload.com/rltzHT.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/64x128/http://i.cubeupload.com/rltzHT.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/64x128/http://i.cubeupload.com/rltzHT.png 2x" /><td><a href="https://steemit.com/carnival/@steemitboard/carnival-challenge-here-are-the-winners" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Carnival Challenge - Here are the winners <h6><a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Hi @dehenne!



Feel free to join our @steem-ua Discord serverYour 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!

Hey, @dehenne!

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

Get higher incentives and support Utopian.io!
SteemPlus or Steeditor). Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via

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

Vote for Utopian Witness!

Congratulations @dehenne! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!