Forum

Thread tagged as: Question, Api, Add-on-development

Perch Database API - CRUD operations on region content?

A client has requested a customization to provide CRUD operations on our content region "retailers". They want the customization on the front-end so it has the same UI as the rest of the site. The page will be password protected so only their sales reps have access to it.

Anyway, I've implemented a RESTful interface, I just need to tie in the backend (instead of returning fake data and mimicking successful create/update/deletes). I'm not familiar with Perch. Is there any code examples you could point me to, to get me sped up? Source files, tutorial, anything.

Thanks!

Wesley Gooch

Wesley Gooch 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure, the API docs are all here: https://docs.grabaperch.com/api/

With a sample app here: https://docs.grabaperch.com/api/sample-app/

What about dealing with perch2_content_index and perch2_content_items tables?

For instance, to update one of my retailers, "All Retailers" region, do something along the lines:

$columnData['itemJSON'] = array(
    'retailer_locname' => 'Some Retailer',
    'retailer_city' => 'Las Vegas'
);

$this->db->update('perch2_content_items', $columnData, 'itemRowID', 123456);

I'm not working with a custom table, just trying to create/update/delete out of the box region items. Does the API take care of other tables? I'm afraid of messing up meta data.

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's no API for manipulating the Content app itself, no.