-
Notifications
You must be signed in to change notification settings - Fork 342
Customizing the attributes returned by the API
Moncef Belyamani edited this page Mar 15, 2015
·
1 revision
Ohana API uses ActiveModel Serializers (version 0.8.1) to generate the JSON output.
The attributes returned by each endpoint are defined in the various serializers.
To add or remove attributes from a particular endpoint, edit the appropriate serializer. The two main serializers are locations_serializer
, which is what the search
endpoint uses, and the location_serializer
, which is used when you query a particular location.
For example, if you want to include the regular_schedules
and holiday_schedules
entities in search results, you would add the following to locations_serializer
:
has_many :regular_schedules
has_many :holiday_schedules
Because location_serializer
inherits from locations_serializer
, you would then also want to remove those same two lines from location_serializer
.