---
updatedAt: 2026-04-08T10:22:21.000Z
agentTools:
  projectIndex: https://developer.goacoustic.com/acoustic-content/llms.txt
---

# Call unauthenticated and authenticated APIs

Learn how to call Content APIs in Java, NodeJS, and Javascript

[block:html]
{
  "html": "<div class=\"mktbox\">\n  <p class=\"image\"><svg margin-top=\" -6px\" width=\"43\" height=\"30\" viewBox=\"0 0 43 30\" fill=\"none\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M26,6V8.17L5.64,11.87a2,2,0,0,0-1.64,2v4.34a2,2,0,0,0,1.64,2L8,20.56V24a2,2,0,0,0,2,2h8a2,2,0,0,0,2-2V22.74l6,1.09V26h2V6ZM18,24H10V20.93l8,1.45ZM6,18.17V13.83L26,10.2V21.8Z\" fill=\"#000000\"></path></svg></p>\n  <h4 class=\"butitle\" >For marketers</h4>\n  <div class=\"Bulinks\">\n      <ul class=\"bulinklist\">\n      <li class=\"butopiclink\"> <a style=\"text-decoration: none; color: #047970;\" data-ctaposition=\"1\" rel=\"noopener noreferrer\" target=\"_blank\"href=\"https://help.goacoustic.com/hc/en-us/articles/360041347794-Enable-API-key-authentication\">Enable API key authentication</a></li>\n    <li class=\"butopiclink\"> <a  style=\"text-decoration: none; color: #047970;\" data-ctaposition=\"1\" rel=\"noopener noreferrer\" target=\"_blank\"href=\"https://help.goacoustic.com/hc/en-us/articles/360037142554-Developers-Deliver-content-with-APIs-\">Developers: Deliver content with APIs </a></li>     \n    </ul>\n  </div>\n</div>\n\n<style>\n   .rdmd-html {\n    \n}\n  .image {\nfloat: left;\nwidth: max-content;\nmargin-bottom: -3px;\npadding-top:10px;\npadding-left:20px;\n  }\n .butitle {\n    padding-top: 5px;\n    margin-bottom: -5px;\n}\n\n  .butopiclink {\n    border-bottom: 1px solid #3d535b;\n    padding: .5rem 0;\n}\n  .mktbox{\n    margin-bottom: 2em;\n    margin-left: 31px;\n    float: right;\n    background-color: #f3f3f4;\n    padding-top:10px;\n    padding-left: 5px;\n    padding-right: 20px;\n    padding-bottom: 20px;\n    z-index: 2;\n  position: relative;\n}\n  .magic-block-html ul:not(.browser-default) > li {\n    list-style-type: none !important;\n  }\n \n</style>"
}
[/block]

## Overview

This getting started tutorial walks you through a simple scenario to retrieve a content item by ID from the delivery content service and the authoring content service. You'll learn how to call unauthenticated and authenticated APIs. By the end of the tutorial, you can make your own calls and retrieve responses from the Acoustic Content APIs.

## Before you begin

**Get familiar with the Acoustic Content APIs**

* Acoustic Content offers you REST-based APIs to create, manage, and deliver your content. For example, use the authoring services API to create and manage content and the delivery services API to integrate content into your applications.
* The format of the Acoustic Content REST API URLs is `{API URL}/{WCH API endpoint}`.
  The API URL is constructed as `Domain name/{path}` where `{path}= api/{Content hub ID}`.
  The API endpoints are described in the Acoustic Content API [documentation](https://developer.goacoustic.com/acoustic-content/reference). For example, use endpoint `/delivery/v1/content/{Item ID}` or endpoint `/authoring/v1/content/{Item ID}` to access content items.
* Most of the APIs require you to authenticate through the `/login/v1/basicauth` endpoint before you can access them except for delivery APIs, which are available to anonymous, unauthenticated callers.

Example: To retrieve  a published content item by ID

1. Get the *Item ID* from the Acoustic Content user interface. Open the specific content item that you want and click the API information icon below the content.
   `ItemId = "b7abe31d-7763-41a9-b8d5-f7cf78565cbd"`
2. Provide the *Item ID* in the delivery API: *{APIURL}/delivery/v1/content/{Item ID}*.
   `https://content-XX-N.content-cms.com/api/12345678-...-56789abcdef0/delivery/v1/content/'b7abe31d-7763-41a9-b8d5-f7cf78565cbd`

[block:html]
{
  "html": " <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css\">\n<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js\"></script>\n<script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js\"></script>\n<ul class=\"nav nav-pills\">\n    <li class=\"active\"><a data-toggle=\"pill\" href=\"#java\">Java</a></li>\n    <li><a data-toggle=\"pill\" href=\"#nodejs\">Node JS </a></li>\n    <li><a data-toggle=\"pill\" href=\"#js\">JavaScript </a></li>\n  </ul>\n\n<div class=\"tab-content\">\n  \n\t\t<div id=\"java\" class=\"tab-pane fade in active\">\n      \n<h2>Get the API URL for your subscription</h2>\n<p>You can get your API URL from the Content Authoring UI.<br>Click <strong>Developer</strong> &gt; <strong>URL information</strong>.  Your API URL would look similar to <code>API URL - https://{Domain name}/api/{ContentID}</code><br>For example, <code>https://content-XX-N.content-cms.com/api/12345678-9abc-def0-1234-56789abcdef0</code>.</p>\n<h2>Make HTTP REST requests from Java</h2>\n<p>This tutorial uses the classes available with J2SE Java 1.8 SDK to make the API calls. The primary classes you would use for making HTTP REST requests from Java include the following, along with other required imports for streams and exceptions. </p>\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Java</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-java\" data-lang=\"java\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"><span class=\"cm-keyword\">import</span> <span class=\"cm-variable\">java</span>.<span class=\"cm-variable\">net</span>.<span class=\"cm-variable\">HttpURLConnection</span>; \n<span class=\"cm-keyword\">import</span> <span class=\"cm-variable\">java</span>.<span class=\"cm-variable\">net</span>.<span class=\"cm-variable\">CookieHandler</span>;  \n<span class=\"cm-keyword\">import</span> <span class=\"cm-variable\">java</span>.<span class=\"cm-variable\">net</span>.<span class=\"cm-variable\">CookieManager</span>;  \n<span class=\"cm-keyword\">import</span> <span class=\"cm-variable\">java</span>.<span class=\"cm-variable\">net</span>.<span class=\"cm-variable\">CookiePolicy</span>;  \n<span class=\"cm-keyword\">import</span> <span class=\"cm-variable\">java</span>.<span class=\"cm-variable\">net</span>.<span class=\"cm-variable\">URL</span>; \n<span class=\"cm-keyword\">import</span> <span class=\"cm-variable\">java</span>.<span class=\"cm-variable\">util</span>.<span class=\"cm-variable\">Base64</span>;\n  </div></code></pre></div>\n</div>\n\n<h2>Define the constants</h2>\n\n<p>Define the constants for the Content API URL,  Content API endpoints, content ID, and the username to authenticate.</p>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Java</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-java\" data-lang=\"java\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"><span class=\"cm-comment\">// Acoustic Content tenant specific API URL, of the form https://{tenant-host}/api/{tenant-id} </span>\n    <span class=\"cm-keyword\">static</span> <span class=\"cm-type\">String</span> <span class=\"cm-variable\">myTenantBaseAPIURL</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"https://content-XX-N.content-cms.com/api/000-...444\"</span>;\n   \n<span class=\"cm-comment\">// Acoustic Content API Endpoints, as found in  API Reference here:  </span>\n<span class=\"cm-comment\">// https://developer.goacoustic.com/acoustic-content/reference</span>\n    <span class=\"cm-keyword\">static</span> <span class=\"cm-type\">String</span> <span class=\"cm-variable\">deliveryContent</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"/delivery/v1/content/\"</span>;  \n    <span class=\"cm-keyword\">static</span> <span class=\"cm-type\">String</span> <span class=\"cm-variable\">authoringContent</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"/authoring/v1/content/\"</span>;\n    <span class=\"cm-keyword\">static</span> <span class=\"cm-type\">String</span> <span class=\"cm-variable\">loginEndpoint</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"/login/v1/basicauth\"</span>;\n<span class=\"cm-comment\">// Content Id for one of the sample articles from the sample package at: </span>\n<span class=\"cm-comment\">// https://github.com/acoustic-content-samples/sample-article-content</span>\n    <span class=\"cm-keyword\">static</span> <span class=\"cm-type\">String</span> <span class=\"cm-variable\">contentId</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"b7abe31d-7763-41a9-b8d5-f7cf78565cbd\"</span>;\n<span class=\"cm-comment\">// Username to test the authenticated authoring APIs with (not needed for delivery APIs)  </span>\n<span class=\"cm-comment\">// Get this from user input or more secure location, for an actual application </span>\n    <span class=\"cm-keyword\">static</span> <span class=\"cm-type\">String</span> <span class=\"cm-variable\">username</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"myusername@mycompany.com\"</span>; \n    <span class=\"cm-keyword\">static</span> <span class=\"cm-type\">String</span> <span class=\"cm-variable\">password</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"mypassword\"</span>;\n</div></code></pre></div>\n</div>\n\n<h2>Create methods to call the delivery and authoring services</h2>\n\n<p>Use the following sample code for creating methods to call the delivery and authoring services.</p>\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Java</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-java\" data-lang=\"java\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"><span class=\"cm-comment\">/* Retrieve specified content item from authoring content service */</span>  \n    <span class=\"cm-keyword\">public</span> <span class=\"cm-type\">String</span> <span class=\"cm-def\">getAuthoringContent</span>(<span class=\"cm-type\">String</span> <span class=\"cm-variable\">contentId</span>) <span class=\"cm-keyword\">throws</span> <span class=\"cm-variable\">IOException</span> {  \n        <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">getWCHArtifact</span>(<span class=\"cm-variable\">authoringContent</span>, <span class=\"cm-variable\">contentId</span>); \n    }\n    <span class=\"cm-comment\">/* Retrieve specified content item from delivery content service */</span> \n    <span class=\"cm-keyword\">public</span> <span class=\"cm-type\">String</span> <span class=\"cm-def\">getDeliveryContent</span>(<span class=\"cm-type\">String</span> <span class=\"cm-variable\">contentId</span>) <span class=\"cm-keyword\">throws</span> <span class=\"cm-variable\">IOException</span> {  \n          <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">getWCHArtifact</span>(<span class=\"cm-variable\">deliveryContent</span>, <span class=\"cm-variable\">contentId</span>); \n    }\n\n    <span class=\"cm-comment\">/* Retrieve a Acoustic Content JSON artifact from specified endpoint by id */</span>  \n    <span class=\"cm-keyword\">public</span> <span class=\"cm-type\">String</span> <span class=\"cm-def\">getWCHArtifact</span>(<span class=\"cm-type\">String</span> <span class=\"cm-variable\">endpoint</span>, <span class=\"cm-type\">String</span> <span class=\"cm-variable\">id</span>) <span class=\"cm-keyword\">throws</span> <span class=\"cm-variable\">IOException</span> {  \n        <span class=\"cm-variable\">URL</span> <span class=\"cm-variable\">url</span> <span class=\"cm-operator\">=</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">URL</span>(<span class=\"cm-variable\">myTenantBaseAPIURL</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">endpoint</span> <span class=\"cm-operator\">+</span> <span class=\"cm-string\">\"/\"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">id</span>);  \n        <span class=\"cm-variable\">HttpURLConnection</span> <span class=\"cm-variable\">connection</span> <span class=\"cm-operator\">=</span> (<span class=\"cm-variable\">HttpURLConnection</span>) <span class=\"cm-variable\">url</span>.<span class=\"cm-variable\">openConnection</span>(); \n        <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">setUseCaches</span>(<span class=\"cm-atom\">false</span>); \n        <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">connect</span>();  \n        <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">getResponse</span>(<span class=\"cm-variable\">connection</span>); \n    }\n\n    <span class=\"cm-comment\">/* Login to Acoustic Content basicauth endpoint, for access to Authoring Services */</span>  \n    <span class=\"cm-keyword\">public</span> <span class=\"cm-type\">String</span> <span class=\"cm-def\">login</span>(<span class=\"cm-type\">String</span> <span class=\"cm-variable\">username</span>, <span class=\"cm-type\">String</span> <span class=\"cm-variable\">password</span>) <span class=\"cm-keyword\">throws</span> <span class=\"cm-variable\">IOException</span> {  \n          <span class=\"cm-type\">String</span> <span class=\"cm-variable\">auth</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">Base64</span>.<span class=\"cm-variable\">getEncoder</span>().<span class=\"cm-variable\">encodeToString</span>((<span class=\"cm-variable\">username</span> <span class=\"cm-operator\">+</span> <span class=\"cm-string\">\":\"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">password</span>).<span class=\"cm-variable\">getBytes</span>(<span class=\"cm-string\">\"UTF-8\"</span>)); \n         <span class=\"cm-variable\">URL</span> <span class=\"cm-variable\">url</span> <span class=\"cm-operator\">=</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">URL</span>(<span class=\"cm-variable\">myTenantBaseAPIURL</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">loginEndpoint</span>); \n         <span class=\"cm-variable\">HttpURLConnection</span> <span class=\"cm-variable\">connection</span> <span class=\"cm-operator\">=</span> (<span class=\"cm-variable\">HttpURLConnection</span>) <span class=\"cm-variable\">url</span>.<span class=\"cm-variable\">openConnection</span>(); \n         <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">setUseCaches</span>(<span class=\"cm-atom\">false</span>); \n         <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">setRequestProperty</span>(<span class=\"cm-string\">\"Authorization\"</span>, <span class=\"cm-string\">\"Basic \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">auth</span>);  \n         <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">connect</span>(); \n         <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">getResponse</span>(<span class=\"cm-variable\">connection</span>);  \n    }\n  </div></code></pre></div>\n</div>\n\n<h2>Get the Content API response from the HttpURLConnection</h2>\n<p>In an actual application use a JSON library to help parse the response JSON and access fields. For the purpose of this tutorial, the following code shows you how to retrieve the JSON and print it out.</p>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Java</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-java\" data-lang=\"java\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"><span class=\"cm-comment\">/* Get the response as a String or throw Exception with error response if http err code */</span>  \n    <span class=\"cm-keyword\">private</span> <span class=\"cm-type\">String</span> <span class=\"cm-def\">getResponse</span>(<span class=\"cm-variable\">HttpURLConnection</span> <span class=\"cm-variable\">connection</span>) <span class=\"cm-keyword\">throws</span> <span class=\"cm-variable\">IOException</span> {  \n       <span class=\"cm-variable\">BufferedReader</span> <span class=\"cm-variable\">in</span> <span class=\"cm-operator\">=</span> <span class=\"cm-atom\">null</span>; \n       <span class=\"cm-type\">String</span> <span class=\"cm-variable\">res</span>; \n       <span class=\"cm-type\">int</span> <span class=\"cm-variable\">responseCode</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">getResponseCode</span>();  \n       <span class=\"cm-keyword\">try</span> { \n           <span class=\"cm-variable\">InputStream</span> <span class=\"cm-variable\">inputStream</span>;  \n           <span class=\"cm-keyword\">if</span> (<span class=\"cm-variable\">responseCode</span> <span class=\"cm-operator\">==</span> <span class=\"cm-number\">200</span>) \n               <span class=\"cm-variable\">inputStream</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">getInputStream</span>();  \n           <span class=\"cm-keyword\">else</span>  \n              <span class=\"cm-variable\">inputStream</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">connection</span>.<span class=\"cm-variable\">getErrorStream</span>(); \n         <span class=\"cm-variable\">in</span> <span class=\"cm-operator\">=</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">BufferedReader</span>(<span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">InputStreamReader</span>(<span class=\"cm-variable\">inputStream</span>));  \n           <span class=\"cm-type\">StringBuilder</span> <span class=\"cm-variable\">strb</span> <span class=\"cm-operator\">=</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-type\">StringBuilder</span>();  \n           <span class=\"cm-type\">String</span> <span class=\"cm-variable\">line</span>;  \n           <span class=\"cm-keyword\">while</span> ((<span class=\"cm-variable\">line</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">in</span>.<span class=\"cm-variable\">readLine</span>()) <span class=\"cm-operator\">!=</span> <span class=\"cm-atom\">null</span>) \n                 <span class=\"cm-variable\">strb</span>.<span class=\"cm-variable\">append</span>(<span class=\"cm-variable\">line</span> <span class=\"cm-operator\">+</span> <span class=\"cm-string\">'\\n'</span>);  \n           <span class=\"cm-variable\">res</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">strb</span>.<span class=\"cm-variable\">toString</span>(); \n      } <span class=\"cm-keyword\">finally</span> {  \n            <span class=\"cm-keyword\">if</span> (<span class=\"cm-variable\">in</span> <span class=\"cm-operator\">!=</span> <span class=\"cm-atom\">null</span>) <span class=\"cm-variable\">in</span>.<span class=\"cm-variable\">close</span>(); \n      } \n       <span class=\"cm-keyword\">if</span> (<span class=\"cm-variable\">responseCode</span> <span class=\"cm-operator\">!=</span> <span class=\"cm-number\">200</span>) \n         <span class=\"cm-keyword\">throw</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">RuntimeException</span>(<span class=\"cm-variable\">res</span>); \n      <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">res</span>;  \n    }\n  </div></code></pre></div>\n</div>\n\n<h2>Retrieve content from delivery and authoring content service</h2>\n<p>The following code uses the methods created above to retrieve a specified content item by ID from the unauthenticated delivery service and then to login and retrieve the same content from the authoring environment.</p>\n\n<blockquote class=\"callout callout_info\" theme=\"📘\">\n        <h3 class=\"callout-heading false\">\n          <span class=\"callout-icon\">📘</span>\n          <p>Note:</p></h3>\n\t<p>In an actual application you would include more logic for handling the response as a JSON object, include additional error handling, and retrieve user credentials from a more secure location if authentication is required.</p>\n\t</blockquote>\n  \n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Java</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-java\" data-lang=\"java\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"> <span class=\"cm-comment\">// We'll start with a fairly lenient cookie manager for this simple sample and accept all cookies from these URLs  </span>\n    <span class=\"cm-variable\">CookieManager</span> <span class=\"cm-variable\">cookieManager</span> <span class=\"cm-operator\">=</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">CookieManager</span>(<span class=\"cm-atom\">null</span>, <span class=\"cm-variable\">CookiePolicy</span>.<span class=\"cm-variable\">ACCEPT_ALL</span>);  \n    <span class=\"cm-variable\">CookieHandler</span>.<span class=\"cm-variable\">setDefault</span>(<span class=\"cm-variable\">cookieManager</span>);\n<span class=\"cm-comment\">// Get and print out a specified content item from the delivery content service </span>\n    <span class=\"cm-variable\">System</span>.<span class=\"cm-variable\">out</span>.<span class=\"cm-variable\">println</span>(<span class=\"cm-string\">\"Delivery Content: \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">getDeliveryContent</span>(<span class=\"cm-variable\">contentId</span>));\n<span class=\"cm-comment\">// Login to Acoustic Content with a user associated with a Acoustic Content tenant </span>\n    <span class=\"cm-variable\">System</span>.<span class=\"cm-variable\">out</span>.<span class=\"cm-variable\">println</span>(<span class=\"cm-string\">\"WCH Login: \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">login</span>(<span class=\"cm-variable\">username</span>, <span class=\"cm-variable\">password</span>));\n<span class=\"cm-comment\">// Make an authenticated request to retrieve a specified content item from authoring content service </span>\n<span class=\"cm-comment\">// The default cookie manager we set above, will help transfer the login response cookies to this request </span>\n    <span class=\"cm-variable\">System</span>.<span class=\"cm-variable\">out</span>.<span class=\"cm-variable\">println</span>(<span class=\"cm-string\">\"Authoring Content: \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">getAuthoringContent</span>(<span class=\"cm-variable\">contentId</span>));\n  </div></code></pre></div>\n</div>\n      \n  \n\t\t</div>\n <!--------------------------End JAVA------------------------------->   \n\t\t\n<div id=\"nodejs\" class=\"tab-pane fade\">\n \n<h2>Get the API URL for your subscription</h2>\n<p>You can get your API URL from the Acoustic Content Authoring UI.<br>Click <em>Developer</em> &gt; <strong>URL information</strong>. Your API URL would look similar to <code>API URL - https://{Domain name}/api/{ContentID}</code><br>For example, <code>https://content-XX-N.content-cms.com/api/12345678-9abc-def0-1234-56789abcdef0</code>.</p>\n<h2>Retrieve content from delivery content service</h2>\n\n<p>Use the request-promise node module to retrieve content from delivery content service<br>The sample code uses <code>request-promise</code> node module, you can use any Node module that works best for you.</p>\n<ol>\n<li value=\"1\">In your NodeJS project add a dependency on request-promise, or similar HTTP request package to your package.json, or npm install the package directly.</li></ol>\n\n\n<blockquote class=\"callout callout_info\" theme=\"📘\">\n        <h3 class=\"callout-heading false\">\n          <span class=\"callout-icon\">📘</span>\n          <p>Note:</p></h3>\n\t<p>Request-promise requires a <em>sibling</em> dependency on the Node JS <em>request</em> module.</p>\n</blockquote>\n\t\n<pre><code>    `_npm install request_ ` \n    `_npm install request-promise_`\n</code></pre>\n<ol>\n<li value=\"2\">Define the base API URL, the Content delivery content URL, and a variable referring to the ID of a published content item.</li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Node JS</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-nodejs\" data-lang=\"nodejs\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"> \n  <span class=\"cm-variable\">_const</span> <span class=\"cm-variable\">request</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">require</span>(<span class=\"cm-string\">\"request-promise\"</span>).<span class=\"cm-property\">defaults</span>({<span class=\"cm-property\">jar</span>: <span class=\"cm-atom\">true</span>});<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_const</span> <span class=\"cm-variable\">baseTenantAPIURL</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">\"https://content-XX-N.content-cms.com/api/00000000-...4444\"</span>;<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_const</span> <span class=\"cm-variable\">deliveryContentURL</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">baseTenantAPIURL</span> <span class=\"cm-operator\">+</span> <span class=\"cm-string\">\"/delivery/v1/content/\"</span>;<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_const</span> <span class=\"cm-variable\">contentId</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">'b7abe31d-7763-41a9-b8d5-f7cf78565cbd'</span>;<span class=\"cm-variable\">_</span>\n  </div></code></pre></div>\n</div>\n\n<ol>\n<li value=\"3\">Retrieve a published content item from the delivery content service with a simple Node JS function.</li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Node JS</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-nodejs\" data-lang=\"nodejs\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"> <span class=\"cm-variable\">_function</span> <span class=\"cm-variable\">getDeliveryContentById</span>(<span class=\"cm-variable\">contentId</span>) {<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_</span>      <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">request</span>({<span class=\"cm-property\">uri</span>: <span class=\"cm-variable\">deliveryContentURL</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">contentId</span>, <span class=\"cm-property\">json</span>: <span class=\"cm-atom\">true</span>});<span class=\"cm-variable\">_</span>  \n        <span class=\"cm-variable\">_</span>}<span class=\"cm-variable\">_</span>\n </div></code></pre></div>\n</div>\n\n<ol>\n<li value=\"4\">Print the retrieved content item to the console. </li></ol>\n\n\n<blockquote class=\"callout callout_info\" theme=\"📘\">\n        <h3 class=\"callout-heading false\">\n          <span class=\"callout-icon\">📘</span>\n          <p>Note:</p></h3>\n<p>An actual application would include additional error handling functionality and application-specific logic with the metadata returned in the content item.</p>\n </blockquote>\n\t\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Node JS</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-nodejs\" data-lang=\"nodejs\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"> <span class=\"cm-variable\">_getDeliveryContentById</span>(<span class=\"cm-variable\">contentId</span>).<span class=\"cm-property\">_</span>  \n<span class=\"cm-variable\">_</span>    <span class=\"cm-variable\">then</span>(<span class=\"cm-def\">content</span> <span class=\"cm-operator\">=&gt;</span> <span class=\"cm-variable\">console</span>.<span class=\"cm-property\">log</span>(<span class=\"cm-variable\">JSON</span>.<span class=\"cm-property\">stringify</span>(<span class=\"cm-variable-2\">content</span>, <span class=\"cm-atom\">null</span>, <span class=\"cm-string\">' '</span>))).<span class=\"cm-property\">_</span>  \n<span class=\"cm-variable\">_</span>    <span class=\"cm-keyword\">catch</span>(<span class=\"cm-def\">err</span> <span class=\"cm-operator\">=&gt;</span> <span class=\"cm-variable\">console</span>.<span class=\"cm-variable\">log</span>(<span class=\"cm-string\">\"Error retrieving delivery content:\"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">JSON</span>.<span class=\"cm-variable\">stringify</span>(<span class=\"cm-variable-2\">err</span>)));<span class=\"cm-variable\">_</span>\n </div></code></pre></div>\n</div>\n\n\n<h2>Retrieve content from authoring content service</h2>\n\n<p>Use the request-promise node module to log in and retrieve content from authoring content service<br>You must log in to Acoustic Content to use the Authoring service API as an authenticated user with a role as Editor, Manager, or Admin. You can log in with the <code>/login/v1/basicauth</code> REST API.</p>\n<ol>\n<li value=\"1\">Define the login and authoring content URLs in addition to the API URL for your subscription and the variable referring to the ID of a content item.</li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Node JS</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-nodejs\" data-lang=\"nodejs\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"> <span class=\"cm-variable\">_const</span> <span class=\"cm-variable\">authoringContentURL</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">baseTenantAPIURL</span> <span class=\"cm-operator\">+</span> <span class=\"cm-string\">\"/authoring/v1/content/\"</span>;<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_const</span> <span class=\"cm-variable\">loginURL</span> <span class=\"cm-operator\">=</span> <span class=\"cm-variable\">baseTenantAPIURL</span> <span class=\"cm-operator\">+</span> <span class=\"cm-string\">\"/login/v1/basicauth\"</span>;<span class=\"cm-variable\">_</span>\n  </div></code></pre></div>\n</div>\n\n\n<ol>\n<li value=\"2\">Login and to get content from the authoring content service with a simple Node JS function</li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Node JS</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-nodejs\" data-lang=\"nodejs\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"><span class=\"cm-variable\">_function</span> <span class=\"cm-variable\">getAuthoringContentById</span>(<span class=\"cm-variable\">contentId</span>) {<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_</span>      <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">request</span>({<span class=\"cm-property\">uri</span>: <span class=\"cm-variable\">authoringContentURL</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">contentId</span>, <span class=\"cm-property\">json</span>: <span class=\"cm-atom\">true</span>});<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_</span>}<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_function</span> <span class=\"cm-variable\">login</span>(<span class=\"cm-variable\">username</span>, <span class=\"cm-variable\">password</span>) {\n<span class=\"cm-variable\">_</span> <span class=\"cm-keyword\">return</span> <span class=\"cm-variable\">request</span>({<span class=\"cm-property\">uri</span>: <span class=\"cm-variable\">loginURL</span>, <span class=\"cm-property\">json</span>:<span class=\"cm-atom\">true</span>,<span class=\"cm-property\">_</span>  \n<span class=\"cm-variable\">_</span> <span class=\"cm-variable\">auth</span>:{<span class=\"cm-string\">\"user\"</span>:<span class=\"cm-variable\">username</span>,<span class=\"cm-string\">\"pass\"</span>:<span class=\"cm-variable\">password</span>,<span class=\"cm-string\">\"sendImmediately\"</span>: <span class=\"cm-atom\">true</span>}<span></span>});<span class=\"cm-variable\">_</span>  \n<span class=\"cm-variable\">_</span>}<span class=\"cm-variable\">_</span>\n</div></code></pre></div>\n</div>\n\n<ol>\n<li value=\"3\">Login, retrieve, and print the JSON response for an authoring content item.</li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">Node JS</button></div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-nodejs\" data-lang=\"nodejs\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button>\n<div class=\"cm-s-neo\"> <span class=\"cm-variable\">_login</span>(<span class=\"cm-string\">\"myWCHTenantUserName@mydomain.com\"</span>, <span class=\"cm-string\">\"myWCHPassword\"</span>).<span class=\"cm-property\">_</span>  \n<span class=\"cm-variable\">_</span>   <span class=\"cm-variable\">then</span>(<span class=\"cm-def\">res</span> <span class=\"cm-operator\">=&gt;</span> <span class=\"cm-variable\">getAuthoringContentById</span>(<span class=\"cm-variable\">contentId</span>)).<span class=\"cm-property\">_</span>  \n<span class=\"cm-variable\">_</span>   <span class=\"cm-variable\">then</span>(<span class=\"cm-def\">content</span> <span class=\"cm-operator\">=&gt;</span> <span class=\"cm-variable\">console</span>.<span class=\"cm-property\">log</span>(<span class=\"cm-variable\">JSON</span>.<span class=\"cm-property\">stringify</span>(<span class=\"cm-variable-2\">content</span>, <span class=\"cm-atom\">null</span>, <span class=\"cm-string\">' '</span>))).<span class=\"cm-property\">_</span>  \n<span class=\"cm-variable\">_</span>   <span class=\"cm-keyword\">catch</span>(<span class=\"cm-def\">err</span> <span class=\"cm-operator\">=&gt;</span> <span class=\"cm-variable\">console</span>.<span class=\"cm-variable\">log</span>(<span class=\"cm-string\">\"Error retrieving authoring content:\"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">JSON</span>.<span class=\"cm-variable\">stringify</span>(<span class=\"cm-variable-2\">err</span>)));<span class=\"cm-variable\">_</span>\n</div></code></pre></div>\n</div>\n \n\t\t</div>\n\n <!-----------------END--------------------->\n\t\t<div id=\"js\" class=\"tab-pane fade\">\n      \n   \n\n<h2> Get the API URL for your tenant</h2>\n<p>You can get your API URL for your tenant from the Content Authoring UI.<br>Click <strong>Developer</strong> &gt; <strong>URL information</strong>. Your API URL would look similar to <code>API URL : https://{Domain name}/api/{ContentID}</code><br>For example, <code>https://content-XX-N.content-cms.com/api/12345678-9abc-def0-1234-56789abcdef0</code>.</p>\n\n<h2>Retrieve content from delivery content service </h2>\n\n<p>Use the sample Content API JS helper to retrieve content from delivery content service<br>The sample <code>wchhelper.js</code> provides a simple wrapper that you can use to construct an instance of the helper for a specific tenant API URL. The sample wchhelper.js makes the REST API calls, handles the <code>xhr</code> request, and the JSON parsing of the response for you.</p>\n<ol>\n<li value=\"1\">Download the sample <a href=\"https://github.com/acoustic-content-samples/sample-js-helper\" target=\"_self\">wchhelper.js</a> helper to a local web application project file as js/wchhelper.js</li>\n<li value=\"2\">Load it with <code>&lt;script src=\"js/wchhelper.js\"&gt;</code></li>\n<li value=\"3\">Construct an instance of the sample helper with the tenant-specific API URL. For example: </li>\n</ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">JavaScript</button>\n</div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-javascript theme-light\" data-lang=\"javascript\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button><div class=\"cm-s-neo\">\n    <span class=\"cm-keyword\">let</span> <span class=\"cm-def\">options</span> <span class=\"cm-operator\">=</span> {\n  <span class=\"cm-property\">url</span>: <span class=\"cm-string\">\"https://{Domain name}/api/{ContentID}\"</span>,\n   <span class=\"cm-property\">debug</span>: <span class=\"cm-atom\">true</span>\n};\n<span class=\"cm-variable\">wchHelper</span> <span class=\"cm-operator\">=</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">WchHelper</span>(<span class=\"cm-variable\">options</span>);\n</div></code></pre></div>\n</div>\n      \n<ol>\n<li value=\"4\">Use the helper to retrieve and display the JSON response for a content item. For example: </li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">JavaScript</button>\n</div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-javascript theme-light\" data-lang=\"javascript\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button><div class=\"cm-s-neo\">\n    <span class=\"cm-variable\">contentId</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">'b7abe31d-7763-41a9-b8d5-f7cf78565cbd'</span>;\n<span class=\"cm-variable\">wchHelper</span>.<span class=\"cm-property\">getDeliveryContentById</span>(<span class=\"cm-variable\">contentId</span>)\n .<span class=\"cm-property\">then</span>(<span class=\"cm-def\">content</span> <span class=\"cm-operator\">=&gt;</span> { <span class=\"cm-variable\">alert</span>(<span class=\"cm-string\">\"Delivery Content response: \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">JSON</span>.<span class=\"cm-property\">stringify</span>(<span class=\"cm-variable-2\">content</span>, <span class=\"cm-atom\">null</span>, <span class=\"cm-string\">' '</span>)) })\n .<span class=\"cm-property\">catch</span>(<span class=\"cm-def\">err</span> <span class=\"cm-operator\">=&gt;</span> { <span class=\"cm-variable\">alert</span>(<span class=\"cm-string\">\"getDeliveryContentById encountered an error: \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable-2\">err</span>); });\n </div></code></pre></div>\n</div>\n\n<h2>Retrieve content from authoring content service</h2>\n<p>Use the sample Content API JS helper to log in and retrieve content from authoring content service<br>You must log in to Content to use the Authoring service API as an authenticated user with a role as Editor, Manager, or Admin. You can use the sample wchhelper.js to log in.</p>\n<ol>\n<li value=\"1\">Construct an instance of the sample helper with the tenant-specific API URL. For example:</li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">JavaScript</button>\n</div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-javascript theme-light\" data-lang=\"javascript\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button><div class=\"cm-s-neo\">\n    <span class=\"cm-keyword\">let</span> <span class=\"cm-def\">options</span> <span class=\"cm-operator\">=</span> {\n  <span class=\"cm-property\">url</span>: <span class=\"cm-string\">\"https://{Domain name}/api/{ContentID}\"</span>,\n  <span class=\"cm-property\">debug</span>: <span class=\"cm-atom\">true</span>\n};\n<span class=\"cm-variable\">wchHelper</span> <span class=\"cm-operator\">=</span> <span class=\"cm-keyword\">new</span> <span class=\"cm-variable\">WchHelper</span>(<span class=\"cm-variable\">options</span>);\n</div></code></pre></div>\n</div>\n  \n<ol>\n<li value=\"2\">Make a call and pass the user name and password for the Content user to log in.</li>\n<li value=\"3\">After successfully logging in, the wchhelper.js calls to retrieve and display the JSON response for an authoring content item. For example:</li></ol>\n\n\n<div class=\"CodeTabs CodeTabs_initial\">\n<div class=\"CodeTabs-toolbar\"><button type=\"button\">JavaScript</button>\n</div>\n<div class=\"CodeTabs-inner\"><pre><code class=\"rdmd-code lang-javascript theme-light\" data-lang=\"javascript\" name=\"\"><button aria-label=\"Copy Code\" class=\"rdmd-code-copy fa\"></button><div class=\"cm-s-neo\">\n    <span class=\"cm-variable\">contentId</span> <span class=\"cm-operator\">=</span> <span class=\"cm-string\">'b7abe31d-7763-41a9-b8d5-f7cf78565cbd'</span>;\n<span class=\"cm-variable\">wchHelper</span>.<span class=\"cm-property\">login</span>(<span class=\"cm-string\">'myWCHuser@mydomain.com'</span>, <span class=\"cm-string\">'myPassword'</span>)\n  .<span class=\"cm-property\">then</span>(<span class=\"cm-def\">tenantId</span> <span class=\"cm-operator\">=&gt;</span> <span class=\"cm-variable\">wchHelper</span>.<span class=\"cm-property\">getAuthoringContentById</span>(<span class=\"cm-variable\">contentId</span>))\n  .<span class=\"cm-property\">then</span>(<span class=\"cm-def\">acontent</span> <span class=\"cm-operator\">=&gt;</span> { <span class=\"cm-variable\">alert</span>(<span class=\"cm-string\">\"Authoring Content response: \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable\">JSON</span>.<span class=\"cm-property\">stringify</span>(<span class=\"cm-variable-2\">acontent</span>, <span class=\"cm-atom\">null</span>, <span class=\"cm-string\">' '</span>)) })\n.<span class=\"cm-property\">catch</span>(<span class=\"cm-def\">err</span> <span class=\"cm-operator\">=&gt;</span> { <span class=\"cm-variable\">alert</span>(<span class=\"cm-string\">\"getAuthoringContentById encountered an error: \"</span> <span class=\"cm-operator\">+</span> <span class=\"cm-variable-2\">err</span>); });\n</div></code></pre></div>\n</div>\n     \n</div>\n <!---------------END---------------->      \n</div>\n  \n  <style>\n    .content-body .header-scroll{\n      font-family: National12, Roboto,sans serif;\n      font-size:24px;\n      color:#13173d;\n      font-weight: 400;\n      line-height: 1.2;\n    }\n   \n    .container {\n      width:100%;\n    }\n    .nav-pills > li.active > a, .nav-pills > li.active > a:hover{\n      color:#fff !important;\n      background-color: #047970;}\n    .nav > li > a{\n      color: #047970 !important;\n      font-family: National2,Roboto,sans serif !important;}\n    .nav > li > a:hover {\n      background-color: #047970;\n      color:#fff !important;}\n    .nav-pills > li > a{\n      border: 1px #047970 solid;}\n    .nav > li > a:focus {\n      background-color: #fff;}\n    .nav-pills > li.active > a, .nav-pills > li.active > a:focus {\n      background-color:#047970!important;}\n    .nav-pills > li + li \n    {\n      margin-top: 0 !important;}\n    </style>"
}
[/block]