<p>I don't have the Venti Calendar plugin, so I can't test this, but it should be as simple as setting the <code>elementType</code> propety to whatever custom element type the plugin has created and you want to use and (optionally) setting any criteria you want defined by the element type.</p>

<pre><code>return [
    'endpoints' =&gt; [
        'news.json' =&gt; [
            'elementType' =&gt; 'Venti_Event',
            'criteria' =&gt; ['key' =&gt; 'value'], 
            'transformer' =&gt; function(Venti_EventModel $eventModel) {
                return [
                    'key' =&gt; $eventModel-&gt;property,
                ];
            },
        },
    ]
];
</code></pre>

CC BY-SA 3.0
2017-01-03T01:09:03.033Z
The custom element type is "Venti_Event".
a-am
CC BY-SA 3.0
2017-01-03T03:06:52.620Z
Cool... I assume there is a `Venti_EventModel` as well?
Brad Bell
CC BY-SA 3.0
2017-01-03T03:27:40.973Z
Yes that would be it Venti_EventModel
a-am
CC BY-SA 3.0
2017-01-03T04:33:48.123Z
Updated answer!
Brad Bell
CC BY-SA 3.0
2017-01-03T18:23:15.470Z
I tried it with 'Venti_EventElementType' as elementType name after searching in the plugin files that was the problem ;) thanx for the answer!
Maarten Heideman
CC BY-SA 3.0
2017-01-02T22:09:47.047Z
2017-01-03T04:33:17.053Z
2017-01-03T04:33:17.053Z
Brad Bell
<p>I want an endpoint in the <a href="https://github.com/pixelandtonic/ElementAPI" rel="nofollow noreferrer">Element API plugin</a> that shows the last event entries from the <a href="https://venticalendar.io" rel="nofollow noreferrer">Venti Calendar</a> plugin. The Element API guide tells that's possible to use the plugin with custom element types. But how? </p>

<plugin-elementapi><plugin-ventievents>
How do you use the Venti Calendar plugin with the Element API plugin?
# How do you use the Venti Calendar plugin with the Element API plugin?

(Asked by: username_0 on 2017-01-02)

I want an endpoint in the [Element API plugin](https://github.com/pixelandtonic/ElementAPI) that shows the last event entries from the [Venti Calendar](https://venticalendar.io) plugin. The Element API guide tells that's possible to use the plugin with custom element types. But how?

**Tags:** plugin-elementapi, plugin-ventievents

---

## 1 answers

### Answer by username_1 on 2017-01-02. Score: 2 | Accepted answer

I don't have the Venti Calendar plugin, so I can't test this, but it should be as simple as setting the elementType propety to whatever custom element type the plugin has created and you want to use and (optionally) setting any criteria you want defined by the element type.
return [
    'endpoints' => [
        'news.json' => [
            'elementType' => 'Venti_Event',
            'criteria' => ['key' => 'value'], 
            'transformer' => function(Venti_EventModel $eventModel) {
                return [
                    'key' => $eventModel->property,
                ];
            },
        },
    ]
];

> **Comments:**
> **username_2**: The custom element type is "Venti_Event".  
> **username_1**: Cool... I assume there is a `Venti_EventModel` as well?  
> **username_2**: Yes that would be it Venti_EventModel  
> **username_1**: Updated answer!  
> **username_0**: I tried it with 'Venti_EventElementType' as elementType name after searching in the plugin files that was the problem ;) thanx for the answer!  

---

