Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Sourced from swagger-ui-dist (then modified) -->
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta charset="UTF-8" />
<title>XPP RESTful Web Services</title>
<link rel="stylesheet" type="text/css" href="swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.css" />
Expand Down
59 changes: 26 additions & 33 deletions docs/swagger-initializer.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
// Sourced from swagger-ui-dist (then modified)

const sandboxMode = location.pathname === '/xpp/documentation/sandbox';
const specJSON = 'xpp-rest.json';
const sandboxMode = location.pathname === "/xpp/documentation/sandbox";
const specJSON = "xpp-rest.json";

window.onload = function() {
window.onload = function () {
const swaggerConfig = {
dom_id: '#swagger-ui',
dom_id: "#swagger-ui",
deepLinking: true,
validatorUrl: null,
filter: true,
advancedFilter: {
enabled: true,
},
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
}
advancedFilter: { enabled: true },
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
plugins: [SwaggerUIBundle.plugins.DownloadUrl],
layout: "StandaloneLayout",
};
if (sandboxMode) {
swaggerConfig.url = specJSON;
swaggerConfig.onComplete = authorizeUser;
Expand All @@ -31,34 +24,34 @@ window.onload = function() {
swaggerConfig.spec = window.xppREST;
}
window.ui = SwaggerUIBundle(swaggerConfig);
}
};

function disableSandbox() {
// Add classname that will hide interactive buttons with CSS
document.body.classList.add('inert');
document.body.classList.add("inert");
// The only way to find out when SwaggerUI has rendered is a MutationObserver
new MutationObserver(records => {
if (records.find(record => record.target.id === 'swagger-ui')) {
new MutationObserver((records) => {
if (records.find((record) => record.target.id === "swagger-ui")) {
// Emulate behavior of SwaggerUI when it is in sandbox mode by linking to the spec’s JSON file
const specTitle = document.querySelector('h2.title');
const specLink = `<a target="_blank" href="${ specJSON }" rel="noopener noreferrer" class="link">${ specJSON }</a>`
specTitle.insertAdjacentHTML('afterend', specLink);
const specTitle = document.querySelector("h2.title");
const specLink = `<a target="_blank" href="${specJSON}" rel="noopener noreferrer" class="link">${specJSON}</a>`;
specTitle.insertAdjacentHTML("afterend", specLink);
}
}).observe(document, { childList: true, subtree: true });
}

async function authorizeUser() {
try {
const response = await fetch('../register', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: 'name=Jane%20Doe&email=jdoe%40example.com'
})
const json = await response.text()
const token = JSON.parse(json).token
window.ui.preauthorizeApiKey('bearerAuth', token);
const response = await fetch("../register", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: "name=Jane%20Doe&email=jdoe%40example.com",
});
const json = await response.text();
const token = JSON.parse(json).token;
window.ui.preauthorizeApiKey("bearerAuth", token);
} catch (error) {
alert('Unable to pre-authorize test user! See the console log for details.');
console.error('Could not pre-authorize test user.', error);
alert("Unable to pre-authorize test user! See the console log for details.");
console.error("Could not pre-authorize test user.", error);
}
}
2 changes: 1 addition & 1 deletion docs/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/swagger-ui.css

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs/xpp-rest.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ h3.opblock-tag span {
padding-bottom: 0;
}


body.inert .authorization__btn,
body.inert .scheme-container {
display: none;
Expand All @@ -112,3 +111,6 @@ body > a {
z-index: 1;
}

body {
background-color: inherit;
}
2 changes: 1 addition & 1 deletion docs/xpp-rest.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/xpp-rest.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Here you will find installation guides, configuration instructions, usage exampl

## Installation

For complete installation and setup information, please refer to the **[XPP Technical Documentation](https://docs.rws.com/en-US/xpp-restful-web-services-1-6-1248383/welcome-to-the-xpp-restful-web-services-documentation-411242)** on the official RWS documentation portal.
For complete installation and setup information, please consult the **[Installation and Release Notes](https://docs.rws.com/api/binary/1264816/1152628)**.

## API Documentation

The documentation for all API calls is available in **<a href="docs/index.html" target="_BLANK">this human-readable HTML web app</a>** that provides a structured overview of all endpoints, request/response formats, supported parameters, and example payloads.

## OpenAPI Specification

The documentation above is derived from **<a href="docs/xpp-rest.json" target="_BLANK">this JSON file</a>** that conforms to version 3.1 of the **[OpenAPI Specification](https://spec.openapis.org/oas/v3.1.0.html)**.
The documentation above is derived from **<a href="docs/xpp-rest.json" target="_BLANK">this JSON file</a>** that conforms to **<a href="https://spec.openapis.org/oas/v3.1.0.html" target="_BLANK">version 3.1 of the OpenAPI Specification</a>**.
2 changes: 1 addition & 1 deletion toc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- name: XPP
- name: XPP RESTful Web Services
href: index.md
Loading