Working with plugin_store_rows with API, Possible?


(Hosein Naseri) #1

Is there any way to get and set plugin_store_rows values with an API call?


(Rafael dos Santos Silva) #2

A PUT to https://example.com/u/USERNAME.json with form data in the format custom_fields[USER_FIELD_NAME] works.


(Hosein Naseri) #3

No I’m not talking about user custom field. I’m talking about plugin_store_rows. As far as I know its consist of the following parameters:

id, plugin_name, key, type_name, value


(Rafael dos Santos Silva) #4

Oh sorry, misread it.

I believe you will need to create a controller in a plugin that accepts your changes


(Hosein Naseri) #5

Thank you. Can you explain a little bit about this controller? How is it look like. Or is there a tutorial I can read?


(Blake Erickson) #6

A controller is a part of the MVC pattern that rails uses.

What are you trying to accomplish? You might need to modify the plugin that is storing the data in the plugin_store_rows table and add a controller to that plugin so that you can make api calls to it rather than a new plugin.

I would look at examples in other plugins (like the discourse-voting plugin) to learn how to add a controller to a plugin.

Another solution might be do use the data explorer plugin to write a query to the plugin_store_rows table. And then you can call that saved query through the api.