{"id":1349,"date":"2024-01-08T14:07:38","date_gmt":"2024-01-08T06:07:38","guid":{"rendered":"https:\/\/www.tonghin.com.my\/blog\/?p=1349"},"modified":"2024-01-08T14:07:39","modified_gmt":"2024-01-08T06:07:39","slug":"adding-attribute-to-item-api","status":"publish","type":"post","link":"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/","title":{"rendered":"Adding attribute to item API"},"content":{"rendered":"\n<p>This week, I began by reworking the item API to include the image path and uom name property to the item list dto in order to obtain the item list query. This is crucial because in order to query the item list, the frontend developer requires these properties. Additionally, when I query the item list using the search name as the basis, I also change the regex options. I&#8217;ve added the option which tells the item list query to disregard any whitespace users may have inadvertently entered.<\/p>\n\n\n\n<p>In addition, I eliminate some superfluous DTO that is not really needed when querying item data for barcodes, as this will make the results easier for frontend developers to read. I&#8217;ve also introduced more properties, which contains the more sub-properties. In addition, I have updated the item detail dto with the UomName attribute.<\/p>\n\n\n\n<p>Mr. Peter discovered that after looking over my code, I needed to add the uom functionality to the item API. This is so that it can remember the uom that is being made or added to each thing. I need to know the uom that is within every object. Thus, I&#8217;ve added a capability to uom that allows you to obtain uom details or lists by id. Since there would be differences in subprice for each uom, I have further included the subprice attribute for each uom.<\/p>\n\n\n\n<p>In order to verify the requirement that the entity id and barcode cannot exist more than once, I have finally refactored the item entity API code. In order to prevent the database from returning an error each time a user adds a new item entity with the same barcode and entity ID, I inserted the unique complex key when I created the item entity table.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week, I began by reworking the item API to include the image path and uom name property to the item list dto in order to obtain the item list query. This is crucial because in order to query the item list, the frontend developer requires these properties. Additionally, when I query the item list &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Adding attribute to item API&#8221;<\/span><\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding attribute to item API | Tong Hin&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding attribute to item API | Tong Hin&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"This week, I began by reworking the item API to include the image path and uom name property to the item list dto in order to obtain the item list query. This is crucial because in order to query the item list, the frontend developer requires these properties. Additionally, when I query the item list &hellip; Continue reading &quot;Adding attribute to item API&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/\" \/>\n<meta property=\"og:site_name\" content=\"Tong Hin&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-08T06:07:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-08T06:07:39+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"2 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\",\"name\":\"TONG HIN MACHINERY\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"sameAs\":[\"https:\/\/www.youtube.com\/channel\/UC60EoxJMNbu8mV0LuEGfrBg\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/wp-content\/uploads\/2020\/10\/web_logo_180_180.jpg\",\"width\":180,\"height\":180,\"caption\":\"TONG HIN MACHINERY\"},\"image\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Tong Hin&#039;s Blog\",\"description\":\"Sharing About Technology\",\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.tonghin.com.my\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/#webpage\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/\",\"name\":\"Adding attribute to item API | Tong Hin&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\"},\"datePublished\":\"2024-01-08T06:07:38+00:00\",\"dateModified\":\"2024-01-08T06:07:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/\",\"name\":\"Adding attribute to item API\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/2ecfc5099c21184cef870f07c87e7c01\"},\"headline\":\"Adding attribute to item API\",\"datePublished\":\"2024-01-08T06:07:38+00:00\",\"dateModified\":\"2024-01-08T06:07:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"articleSection\":\"Experiential\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/08\/adding-attribute-to-item-api\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/2ecfc5099c21184cef870f07c87e7c01\",\"name\":\"Lee Boon Hao\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/df849a70b358c24e8b186103d8dba306?s=96&d=mm&r=g\",\"caption\":\"Lee Boon Hao\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1349"}],"collection":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/comments?post=1349"}],"version-history":[{"count":2,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1349\/revisions"}],"predecessor-version":[{"id":1361,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1349\/revisions\/1361"}],"wp:attachment":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/media?parent=1349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/categories?post=1349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/tags?post=1349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}