> For the complete documentation index, see [llms.txt](https://knowledgebase.fabricdata.com/xytech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.fabricdata.com/xytech/rest-api/openapi-definition.md).

# OpenAPI Definition and Endpoints

### Summary Index

From Xytech version v10.2, an OpenAPI (previously referred to as Swagger) index page has been introduced to assist in the navigation and generation of OpenAPI definitions. The index page can be found by entering the base URL of your site (you use for accessing the Xytech UI) and adding “/ApiDocs” to the end (e.g. `www.xytechexample.com/XYT_TEST/ApiDocs`). The Xytech API Index page is displayed.&#x20;

*API Index Page*

<figure><img src="/files/IqA9sA5JXZy9W7z3ByJP" alt=""><figcaption></figcaption></figure>

### Using the Index

The index page displays groups of endpoints called modules for the selected database. Clicking on a module will reveal the endpoints within that module. Click on an endpoint, and the OpenAPI definition will be generated using the Swagger UI.

The Index is comprised of the following areas:

* Selected Database: The name of the database currently selected for this host.
* Available Databases: (Where multiple databases exist on the same host) Click a database to select it and view its associated endpoint modules.
* Filter Documents: Enter text into this field and press \[Enter] to display matching endpoint descriptions.
* Module and Document List: Only modules in the selected database are displayed. Click any Module to expand and show the endpoints it contains. Each endpoint has a label that describes its type (Document \[maintenance], List, or Setup).

{% hint style="info" %}
Demo OpenAPI definitions See a demo of Xytech OpenAPI definitions [here](https://wcudemo.xytechcloud.com/mp_int/apidocs)
{% endhint %}

### Mandatory Fields Note

The OpenAPI definition model identifies many fields as mandatory (nullable: false), which indicates that a value must be provided when the item is written to the database. However, in some cases, the business logic will provide default values, so it may not be strictly necessary to pass values for all mandatory fields to the API to create a new record. \
For example, in a basic payload to create a Work Order, OpenAPI identifies at least 25 fields as mandatory, but the most basic payload to create a Work Order requires 7.

### For versions prior to v10.2

For versions prior to v10.2 you will need to generate the OpenAPI documentation manually for each document endpoint. Use a browser to generate the OpenAPI document:\
`http://{host}:{port}/API/v2/database/{db_name}/spec/{docName}`

For example: \
`http://myhost:8088/API/v2/database/mp10/spec/JmJob`

The above URL will generate the OpenAPI document and then display the OpenAPI document. To display generated OpenAPI documents, browse to:\
`http://{host}:{port}/REST/SwaggerUI/dist/index.html?document={docName}_v2`

For example:\
`http://myhost:8088/REST/SwaggerUI/dist/index.html?document=JmDivision_v2`

### Endpoint List

There are over 1000 individual documents (endpoints) available to Xytech's REST API. Below is a small sample of those documents. The full list of available documents can be obtained directly from the Xytech UI using the Document Customizations list found under the System module. Specific details on each document can be found via the OpenAPI (Swagger) documentation.

| **ID** | **Class Name**  | **Document Description** | **Document Type** |
| ------ | --------------- | ------------------------ | ----------------- |
| 10315  | JmJob           | Job                      | Maintenance       |
| 315    | JmJobList       | Jobs                     | Select (List)     |
| 10317  | JmJobStatus     | Job Statuses             | Setup             |
| 10318  | JmJobTable1     | Subscription             | Setup             |
| 10322  | JmJobType       | Job Types                | Setup             |
| 359    | JmTrxReport     | Transaction Reports      | Select (List)     |
| 10339  | JmWorkOrder     | Work Order               | Maintenance       |
| 10346  | JmWoTransaction | Work Order Transactions  | Maintenance       |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://knowledgebase.fabricdata.com/xytech/rest-api/openapi-definition.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
