Oracle Content & Experience Cloud Service: API REST Example


The following example shows how to make a REST API call to get folder information from ann HTML page:

<html>

<head>

function UserAction() {

    var xhttp = new XMLHttpRequest();

    xhttp.open("GET", "https://docs-xxxxxx.documents.us2.oraclecloud.com//documents/api/1.1/folders/FDE2F2015454AB1596AF3404090B9CFF7042366FBD9C", false);

    xhttp.setRequestHeader("Accept", "application/json, text/plain, */*");

    xhttp.setRequestHeader("Authorization", "Basic " + btoa(document.getElementById('u').value + ':' + document.getElementById('p').value ));

    xhttp.send();

    alert( document.getElementById('u').value );

    var response = JSON.parse(xhttp.responseText);

    alert(response.ownedBy.displayName);

}

</head>

<body>

     <form>

  User name:<br>

  <input type="text" name="username" id="u"><br>

  User password:<br>

  <input type="password" name="psw" id="p">

</form>

<button type="submit" onclick="UserAction()">Search</button>

</body>

</html>

Related post

Enjoy 😉

IT

javier mugueta View All →

Me and my circumstance

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: