< 022020-07-03⋎04 >

farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Feature requests and bug reports: github.com/farmOS/farmOS/issuesSet by ChanServ on 2018-08-16 at 14:32
13:02*ghpstudent[m] has joined
13:08ghpstudent[m]Hello all, im a (very) new user to FarmOS and i'm interested in using its API feature. My problem however, is that for some reason, i can't seem to make the API work... Whenever i try and call it using postman (eg. the "/farm.json" that is being used as an example on FarmOS api page) i get a status code "403 Forbidden". Again, im not sure what i'm doing wrong... I havent set up any authentication/authorization but,
13:08ghpstudent[m]unless i've missed it, it doesnt seem like a requirement. Anyone know how to make the API work?
13:08mstenta[m]Hi ghpstudent
13:09mstenta[m]Everything in farmOS requires a user login to access
13:09mstenta[m]So you do need to authenticate
13:09mstenta[m]There are various ways to do that, described here: farmos.org/development/api/#authenticati
13:09mstenta[m]Hope that helps!
13:16*sent a long message: < matrix.org/_matrix/media/r0/download/mat >
13:55mstenta[m]Oh yea I think I remember that...
13:56mstenta[m]I think it just means that, by default, you need a user with a name that begins with "restws" eg: "restws-myusername"
13:56mstenta[m]To change that, you need to add a line to your `settings.php` file that overrides a variable
13:56mstenta[m]I think there's an example in the restws readme file?
13:57mstenta[m]git.drupalcode.org/project/restws/blob/H
13:57*sent a long message: < matrix.org/_matrix/media/r0/download/mat >
13:57mstenta[m]So, to allow ANY user, I think you would add:
13:58mstenta[m]$conf['restws_basic_auth_user_regex'] = '/^.*/';
13:58mstenta[m] * `$conf['restws_basic_auth_user_regex'] = '/^.*/';`
13:58mstenta[m]But I have never done that, so you may need to play around with it
14:32ghpstudent[m]Thanks again for the reply! :) I'll play around with it a little and share my results
14:34mstenta[m]Sure thing! Good luck
16:10symbioquine[m]Perhaps it is worth reiterating that the regex above only applies to HTTP basic auth - i.e. auth where the username/password are passed in the `Authorization` header (populated by the curl -u option). It's only slightly more complicated to use the "Session Cookie and CSRF Token" strategy described by farmos.org/development/api/ which should work with any username out-of-the-box.
16:28mstenta[m]Yes and now we also have an oauth option! :-)
16:47*friedrich[m]1 has joined

< 022020-07-03⋏04 >