5. Creating an Resource Class

Dave Wexler edited this page Jan 11, 2017 · 2 revisions

Resource Class is a RESTful resource

On the new Resource Class just choose a "Resource collection name" and an "Individual resource name" (that is usually just the singular of the collection).

On successful creation you should next proceed to it's Dashboard.

There you can model your Resource Classes in a similar way as you model your backends in MVC frameworks. So think of it as the Active Record or Active Model of the API world. Try to avoid complex attribute data types like object, hash and array, etc. You'll instead be able to create relations between your Resource Classes and request Compund Documents.

Create a couple of attributes and specify their data types. Click save on top of the attributes panel.

Pick an identifier. Some attribute that is unique for each of your datasets. You'll access single entries of your Resource Class when you're done.

If you already mapped a Web Interface taking URL parameters, you are expected to have all these parameter names as attributes in your Resource Class. These are always obligatory and filterable.

By clicking "Edit" on a single attribute, you can configure it f.e. to be filterable. Read Up. Also, you can declare a certain attribute follows an international standard, which is a powerful feature, since it makes your Resource Class interconnectable with other APIs on XapiX. If you are missing a standard, open a GitHub Issue.

The Relationships section will let you draw relationships between Resource Classes. As for now only to_one relationships are supported, you'll pick an attribute that is the "foreign key" and an Outpoint Endpoint it's related to (this Resource Class "foreign key" attribute value == Referenced Resource Class individual resource identifier attribute value).

The righthand "Result Based on Mapped Web Interface Data Samples" section, indicates if your existing mappings all went good.

If you got cached Mappings for this Resource Class you can press the "Publish" button on top to run a cache update after making changes.