{"id":512,"date":"2020-11-23T17:38:54","date_gmt":"2020-11-23T17:38:54","guid":{"rendered":"https:\/\/cupl.co.uk\/?page_id=512"},"modified":"2020-12-18T09:56:53","modified_gmt":"2020-12-18T09:56:53","slug":"cuplbackend-admin-api","status":"publish","type":"page","link":"https:\/\/cupl.co.uk\/index.php\/software\/cuplbackend\/cuplbackend-admin-api\/","title":{"rendered":"Admin API"},"content":{"rendered":"\n<p><a href=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml\" data-type=\"URL\" data-id=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml\">API Documentation<\/a><\/p>\n\n\n\n<p>This is a password-protected API. It is the only way to create or delete a new tag and view its secretkey. Capture data can be added manually (without decoding a cuplURL).<\/p>\n\n\n\n<h2>Add a Tag<\/h2>\n\n\n\n<p>cuplbackend stores data from multiple cuplTags. Each is identified by an 8-character <strong>serial <\/strong>string. <\/p>\n\n\n\n<p>Data captured from a tag are authenticated with an HMAC. This prevents the database from being filled with bad data. The HMAC is derived from a <strong>secret key <\/strong>of 16 random characters.   <\/p>\n\n\n\n<p>The serial and secret key can either be supplied to the <a href=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml#operation\/TagPost\" data-type=\"URL\" data-id=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml#operation\/TagPost\">create tag<\/a> endpoint or generated automatically. Both are stored in cuplbackend and written to a cuplTag at production time.<\/p>\n\n\n\n<figure class=\"wp-block-image size-medium\"><img loading=\"lazy\" width=\"300\" height=\"186\" src=\"https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/tag_graphic-300x186.png\" alt=\"\" class=\"wp-image-536\" srcset=\"https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/tag_graphic-300x186.png 300w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/tag_graphic-600x371.png 600w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/tag_graphic-1024x633.png 1024w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/tag_graphic-768x475.png 768w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/tag_graphic.png 1064w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<h2>Simulate a Tag<\/h2>\n\n\n\n<p>The API includes a <a href=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml#operation\/TagSimGet\" data-type=\"URL\" data-id=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml#operation\/TagSimGet\">simulate<\/a> endpoint, which wraps around the encoder part of <a href=\"https:\/\/cupl.co.uk\/index.php\/cuplcodec\/\">cuplcodec<\/a>. It sets up a virtual tag and feeds its sensors with a sinusoidal data stream. This makes it easy to test the backend. There is no need to pick up a phone to scan a physical <a href=\"https:\/\/cupl.co.uk\/index.php\/cupltag\/\" data-type=\"page\" data-id=\"177\">cuplTag<\/a>. <\/p>\n\n\n\n<figure class=\"wp-block-image size-medium\"><img loading=\"lazy\" width=\"300\" height=\"129\" src=\"https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/simulate_tag-300x129.png\" alt=\"\" class=\"wp-image-540\" srcset=\"https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/simulate_tag-300x129.png 300w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/simulate_tag-600x258.png 600w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/simulate_tag-1024x440.png 1024w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/simulate_tag-768x330.png 768w, https:\/\/cupl.co.uk\/wp-content\/uploads\/2020\/12\/simulate_tag.png 1321w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<h2>Create, Read, Update and Delete resources (with a token)<\/h2>\n\n\n\n<p>All endpoints on the cuplbackend AdminAPI require a <a href=\"https:\/\/tools.ietf.org\/html\/rfc6750\" data-type=\"URL\" data-id=\"https:\/\/tools.ietf.org\/html\/rfc6750\">bearer token<\/a>. This is yielded by the <a href=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml#operation\/TokenPost\" data-type=\"URL\" data-id=\"https:\/\/redocly.github.io\/redoc\/?url=https:\/\/raw.githubusercontent.com\/cuplsensor\/cuplbackend\/32882118c93e564f40fd17192fd6b1cdaf3e6014\/docs\/api\/admin\/api.yaml#operation\/TokenPost\">obtain token<\/a> endpoint upon receiving a valid CLIENT_ID and CLIENT_SECRET. Both are <a href=\"https:\/\/cupl.readthedocs.io\/projects\/backend\/en\/latest\/docs\/wsbackend\/environmentvariables.html#admin-api\" data-type=\"URL\" data-id=\"https:\/\/cupl.readthedocs.io\/projects\/backend\/en\/latest\/docs\/wsbackend\/environmentvariables.html#admin-api\">environment variables<\/a> and the latter must be supplied for cuplbackend to run.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>API Documentation This is a password-protected API. It is the only way to create or delete a new tag and view its secretkey. Capture data can be added manually (without decoding a cuplURL). Add a Tag cuplbackend stores data from multiple cuplTags. Each is identified by an 8-character serial string. Data captured from a tag&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":173,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"spay_email":""},"featured_image_urls":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable":"<p>API Documentation This is a password-protected API. It is the only way to create or delete a new tag and view its secretkey. Capture data can be added manually (without decoding a cuplURL). Add a Tag cuplbackend stores data from multiple cuplTags. Each is identified by an 8-character serial string. Data captured from a tag are authenticated with an HMAC. This prevents the database from being filled with bad data. The HMAC is derived from a secret key of 16 random characters. The serial and secret key can either be supplied to the create tag endpoint or generated automatically. Both&hellip;<\/p>\n","category_list":"","author_info":{"name":"malcolmmackay","url":"https:\/\/cupl.co.uk\/index.php\/author\/malcolmmackay\/"},"comments_num":"0 comments","featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable_v2":"<p>API Documentation This is a password-protected API. It is the only way to create or delete a new tag and view its secretkey. Capture data can be added manually (without decoding a cuplURL). Add a Tag cuplbackend stores data from multiple cuplTags. Each is identified by an 8-character serial string. Data captured from a tag are authenticated with an HMAC. This prevents the database from being filled with bad data. The HMAC is derived from a secret key of 16 random characters. The serial and secret key can either be supplied to the create tag endpoint or generated automatically. Both&hellip;<\/p>\n","category_list_v2":"","author_info_v2":{"name":"malcolmmackay","url":"https:\/\/cupl.co.uk\/index.php\/author\/malcolmmackay\/"},"comments_num_v2":"0 comments","_links":{"self":[{"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/512"}],"collection":[{"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=512"}],"version-history":[{"count":18,"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/512\/revisions"}],"predecessor-version":[{"id":798,"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/512\/revisions\/798"}],"up":[{"embeddable":true,"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/pages\/173"}],"wp:attachment":[{"href":"https:\/\/cupl.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}