What role / permissions an API user should have to be able to view and edit ALL assets and logs?

Hi everyone,

I am exploring using the API to load data into my farmOS instance which is hosted on Farmier . Mostly because the CSV import functionality for importing plant types terms in the taxonomy is too limited (does not include fields for crop family & reference URI) . So I am now on a mission to understand the API and to get myself started i used a postman collection and right now just trying simple stuff such as getting data . Mostly so i understand the schema for the assets i am interested in importing.

I created an API user via the UI with manager role , hoping it would be sufficient to access all the data. But as i was trying to get a simple plant asset i am facing permissions issues. I then tried my own admin user and creator of the asset but same issue.

I can’t see an easy way to “see” all available roles and permissions in farmos and even then I would not know how to grant role and permission to a user if this is not available in the UI

I would appreciate any help on this issue

1 Like

Hi @agnes - welcome to the community! :slight_smile:

It sounds like you are on the right track. A user with the “Manager” role will have access to all records. But it depends on how your are authorizing with OAuth.

First, you need a “client ID” (aka “Consumer”) configured in farmOS that defines which authorization flows are allowed, and what scopes can be used. We provide scopes for the manager, worker, and viewer roles, but you can also build your own in a module. The “farmOS Default API Consumer” module will add a simple farm client ID that allows for a password authorization flow, so you can use a username and password to authorize. You need to reference the client_id of farm, and the scope of farm_manager.

This shows an example with the curl command: Authentication | farmOS

If you still have trouble, please post some examples or screenshots and maybe we can help figure out what’s wrong.

FYI farmOS v4 now includes “config fields” in CSV importers by default, which means that the “Crop family” and some other fields are now included in the “Plant type” term CSV importer.

The “reference URI” field is not yet supported, but that would be an easy and obvious next step! If you’re interested in helping with that I can provide some pointers for where to start…

… that said, it’s still valuable to learn the API! That gives you the most control. :slight_smile:

Thank you ! I ended up using the api to import plant types . Which version of farmOS is hosted on Farmier ?

1 Like

Farmier is hosting the latest stable release (3.4.6). I just released 3.5.0 yesterday and will be deploying that to Farmier soon.

We’ve also been working hard on farmOS v4 for the past year, so expect a release of that in the near future too!

PS: You can see the farmOS version in the /api endpoint under meta.farm.version.

1 Like