Create an ad-hoc class
The data behavior of an XDM schema is determined by its underlying class. The first step in creating an ad-hoc schema is to create a class based on the adhoc behavior. This is done by making a POST request to the /tenant/classes endpoint.
API format
Request
The following request creates a new XDM class, configured by the attributes supplied in the payload. By supplying a $ref property set to https://ns.adobe.com/xdm/data/adhoc in the allOf array, this class inherits the adhoc behavior. The request also defines an _adhoc object, which contains the custom fields for the class.
_adhoc vary depending the use case of the ad-hoc schema. Please refer to the specific workflow in the appropriate tutorial for required custom fields based on use case.| Property | Description |
|---|---|
$ref | The data behavior for the new class. For ad-hoc classes, this value must be set to https://ns.adobe.com/xdm/data/adhoc. |
properties._adhoc | An object that contains the custom fields for the class, expressed as key-value pairs of field names and data types. |
Response
A successful response returns the details of the new class, replacing the properties._adhoc object’s name with a GUID that is a system-generated, read-only unique identifier for the class. The meta:datasetNamespace attribute is also generated automatically and included in the response.
| Property | Description |
|---|---|
$id | A URI that serves as the read-only, system generated unique identifier for the new ad-hoc class. This value is used in the next step of creating an ad-hoc schema. |
Create an ad-hoc schema
Once you have created an ad-hoc class, you can create a new schema that implements that class by making a POST request to the /tenant/schemas endpoint.
API format
Request
The following request creates a new schema, providing a reference ($ref) to the $id of the previously created ad-hoc class in its payload.
Response
A successful response returns the details of the newly created schema, including its system-generated, read-only $id.
View the full ad-hoc schema
Once the ad-hoc schema has been created, you can make a lookup (GET) request to view the schema in its expanded form. This is done by using the appropriate Accept header in the GET request, as demonstrated below.
API format
| Parameter | Description |
|---|---|
{SCHEMA_ID} | The URL-encoded $id URI or meta:altId of the ad-hoc schema you want to access. |
Request
The following request uses the Accept header application/vnd.adobe.xed-full+json; version=1, which returns the expanded form of the schema. Note that when retrieving a specific resource from the Schema Registry, the request’s Accept header must include major version of the resource in question.
Response
A successful response returns the details of the schema, including all fields nested under properties.
Next steps
By following this tutorial, you have successfully created a new ad-hoc schema. If you were brought to this document as part of another tutorial, you can now use the $id of your ad-hoc schema to complete the workflow as directed.
For more information on working with the Schema Registry API, please refer to the developer guide.
More help on this topic
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAgentic AI Roadmap Webinar - Americas & EMEA
Preview the Agentic AI roadmap, see Agent Orchestrator in action, and ask the team.
Agentic AI Roadmap Webinar - Americas & APAC
Preview the Agentic AI roadmap, see Agent Orchestrator in action, and ask the team.
Adobe Experience Platform + Apps Roadmap Webinar - Americas & EMEA
Preview the Experience Platform and Apps roadmap and ask the product team questions.