{"id":36964,"date":"2024-10-18T00:00:00","date_gmt":"2024-10-17T23:00:00","guid":{"rendered":"https:\/\/developers.ila.cegid.com\/valuekeep\/\/"},"modified":"2025-01-14T11:37:50","modified_gmt":"2025-01-14T10:37:50","slug":"webapi-creating-a-unit","status":"publish","type":"valuekeep","link":"https:\/\/developers.ila.cegid.com\/en\/valuekeep\/development-en\/transversal-en\/article\/webapi-creating-a-unit","title":{"rendered":"How to create or delete a unit?"},"content":{"rendered":"<section class=\"av_textblock_section \"  itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock  '   itemprop=\"text\" ><p>It is possible to create or delete a unit.<\/p>\n<div><\/div>\n<div><\/div>\n<\/div><\/section>\n<section class=\"av_textblock_section \"  itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock  '   itemprop=\"text\" ><h2>Creating a unit<\/h2>\n<p>This method allows to create a unit in a simplified manner.<\/p>\n<p>The method to be used when creating a unit is: <b>POST url\/api\/mytenant\/myorganization\/corepatterns\/units<\/b><\/p>\n<div>Json example for creating a unit:<\/div>\n<div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\">{\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"unitKey\":\u00a0\"HR\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"description\":\u00a0\"Hora\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"precisionDigits\":\u00a02,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"conversionFactor\":\u00a01.0,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"symbol\":\u00a0\"HR\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"isDimensionBaseUnit\":\u00a0false,\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"dimension\":\u00a0\"01\"\r\n\u00a0\u00a0\u00a0\u00a0}<\/pre>\n<p><span style=\"font-size: 12pt;\">This method allows to create a unit according to the parameters <\/span><span style=\"font-size: 12pt;\">filled in:<\/span><\/p>\n<\/div>\n<div>\n<ol>\n<li><b>unitKey<\/b>:\u00a0The key of the unit. Mandatory field.<\/li>\n<li><b>description<\/b>: Short description of the unit. This field is mandatory.<\/li>\n<li><b>precisionDigits<\/b>: Number of decimal places.<\/li>\n<li><b>conversionFactor<\/b>: Conversion factor.<\/li>\n<li><b>symbol<\/b>: Symbol.<\/li>\n<li><b>isDimensionBaseUnit<\/b>: Dimension base unit. Fill in this field with true or false. There can only exist one unit with this field active (true).<\/li>\n<li><b>dimension<\/b>: Dimension. (01-Quantity; 02- Weight; 03-Time; 04-Length). Mandatory field.<\/li>\n<\/ol>\n<p class=\"MsoNormal\" style=\"margin-bottom: 0cm; line-height: normal;\"><span style=\"font-size: 11.5pt;\">When this method is executed successfully, it returns HttpStatusCode.201Created.<\/span><\/p>\n<\/div>\n<div><\/div>\n<\/div><\/section>\n<section class=\"av_textblock_section \"  itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\" ><div class='avia_textblock  '   itemprop=\"text\" ><h2>Deleting a unit<\/h2>\n<p>This method allows you to delete a unit.<\/p>\n<div>The method to be used when deleting a unit is: <b>DELETE\u00a0 url\/api\/mytenant\/myorganization\/corepatterns\/units\/{{unitKey}}<\/b><\/div>\n<div><\/div>\n<div>The parameters being replaced on the method are:<\/div>\n<ul>\n<li class=\"sty__v6iprf__cls\"><b>unitKey<\/b>: key of the unit you wish to delete.<\/li>\n<\/ul>\n<div>\n<div>When this method is executed successfully, it returns HttpStatusCode.204.<\/div>\n<\/div>\n<\/div><\/section>\n","protected":false},"excerpt":{"rendered":"","protected":false},"featured_media":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","format":"standard","tags":[1034],"videos_tax":[],"post-type":[300],"categoria-valuekeep":[947],"class_list":["post-36964","valuekeep","type-valuekeep","status-publish","format-standard","hentry","tag-units-en","post-type-artigo","categoria-valuekeep-transversal-en"],"_links":{"self":[{"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/valuekeep\/36964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/valuekeep"}],"about":[{"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/types\/valuekeep"}],"replies":[{"embeddable":true,"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/comments?post=36964"}],"version-history":[{"count":0,"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/valuekeep\/36964\/revisions"}],"wp:attachment":[{"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/media?parent=36964"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/tags?post=36964"},{"taxonomy":"videos_tax","embeddable":true,"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/videos_tax?post=36964"},{"taxonomy":"post-type","embeddable":true,"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/post-type?post=36964"},{"taxonomy":"categoria-valuekeep","embeddable":true,"href":"https:\/\/developers.ila.cegid.com\/en\/wp-json\/wp\/v2\/categoria-valuekeep?post=36964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}