Retrieve the Schema of Custom Fields

To retrieve the schema of custom fields of an entity—that is, the field name, view name, and type of the fields that are not defined in the contract of the endpoint for this entity—by using the contract-based REST API, you access the needed URL with the GET HTTP method. See the following sections for details on the request and the response.

Tip:
Custom fields can correspond to the following elements:
  • The predefined elements on an MYOB Acumatica form that are not included in the entity definition
  • The elements that were added to the MYOB Acumatica form in a customization project
  • The user-defined fields

HTTP Method and URL

If you need to obtain the schema of custom fields of an entity, you use the GET HTTP method and the following URL.
http://<Base endpoint URL>/<Top-level entity>/$adHocSchema
The URL includes the following components:
  • <Base endpoint URL> is the URL of the contract-based endpoint through which you are going to work with MYOB Acumatica, which has the following format: http://<MYOB Acumatica instance URL>/entity/<Endpoint name>/<Endpoint version>/.
  • <Top-level entity> is the name of the entity for which you are going to retrieve the schema of custom fields.

For example, suppose that you want to obtain the schema of custom fields of a stock item entity from a local MYOB Acumatica instance with the name AcumaticaDB by using the system endpoint with the name Default and Version 23.200.001. You would use the following URL to retrieve the schema.

http://localhost/AcumaticaDB/entity/Default/23.200.001/StockItem/$adHocSchema

Parameters

You use no parameters when you retrieve the schema of custom fields.

Request Headers

You can specify the following header in the request.

HeaderDescription
Accept

Specifies the format of the response body, which should be application/json.

Response Status Codes

The following table lists the HTTP status codes that the system returns for a request that retrieves the schema of the custom fields of an entity.

Code Description
200 The request has been completed successfully. The response contains the field name, view name, and type of the fields that are not defined in the contract of the endpoint for the entity.
401

The user is not signed in to the system.

403

The user has insufficient rights to access the MYOB Acumatica form that corresponds to the entity.

429

The number of requests has exceeded the limit imposed by the license (see License Restrictions for API Users).

500

An internal server error has occurred.

Example

The following request shows an example of the retrieval of the schema of custom fields of the StockItem entity.
Tip:
In the request example below, <MYOB Acumatica instance URL> is the URL of the MYOB Acumatica instance (such as https://my.acumatica.com/MyInstance). You can omit the instance name in the URL (that is, you can use https://my.acumatica.com) if the instance is installed in the root of the website.
GET /$adHocSchema HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/StockItem
Accept: application/json
Content-Type: application/json