IRC logs for #farmOS, 2018-12-27 (GMT)

2018-12-26
2018-12-28
TimeNickMessage
[09:59:59]<mstenta[m]>munjoma: I fixed the consideration table issue
[10:00:00]<mstenta[m]>https://github.com/farmOS/farmOS/issues/123#issuecomment-450166026
[10:00:59]<mstenta[m]>It will be included in the next official release of farmOS
[10:01:14]<mstenta[m]>If you want to use it before then, you will need to use the development version (maybe you are already)
[11:31:17]* JustTB has joined #farmos
[11:43:41]* JustTB has quit (Ping timeout: 250 seconds)
[11:45:05]* JustTB has joined #farmos
[11:51:03]* JustTB has quit (Ping timeout: 250 seconds)
[12:09:06]* emilyfarmer[m] has joined #farmos
[13:19:44]* JustTB has joined #farmos
[13:41:59]<paul121[m]>Okay, working with the API. I'm trying to pull information about Planting assets. I can get the assets, now I'm trying to get associated crops, seedings, and transplanting. I know I can do this in a series of requests to the api, but wondering if it would be possible in just one request? Can we define custom 'views' for the API?
[13:42:00]* JustTB has quit (Ping timeout: 252 seconds)
[13:47:07]<mstenta[m]>paul121: Unfortunately I don't think that's possible right now - farmOS relies on the RESTful Web Services module for Drupal, so we are limited to what it can do: https://www.drupal.org/project/restws
[13:47:33]<mstenta[m]>But... looking to the future... when farmOS is upgraded to Drupal 8 we will have a lot more API options available.
[13:47:47]* JustTB has joined #farmos
[13:47:49]<mstenta[m]>Including this: https://www.drupal.org/project/graphql
[13:49:09]<mstenta[m]>Drupal made "API first" a big priority in D8
[13:49:35]<mstenta[m]>The restws module (which was a separate contrib module in D7) was pulled into Drupal core and greatly improved upon
[13:49:49]<mstenta[m]>And many more options are now being built in the D8 contrib space
[13:49:52]<mstenta[m]>like GraphQL
[13:50:08]<mstenta[m]>and JSON API
[13:50:09]<mstenta[m]>https://www.drupal.org/project/jsonapi
[13:51:12]<paul121[m]>Woah. GraphQL looks awesome. Yeah, looking forward to D8....
[13:51:19]<mstenta[m]>Yea agreed!
[13:51:45]<mstenta[m]>So yea, we're just kind of in that in-between time now... really hoping for a chance to focus on the upgrade in 2019
[13:52:23]<paul121[m]>What about authentication, I saw that OAuth is in the pipeline... before D8?
[13:52:59]<mstenta[m]>Yea maybe before D8... depends on if it's deemed necessary for any sponsored projects
[13:53:36]<mstenta[m]>Those are really what's driving priorities right now
[13:54:06]<mstenta[m]>But I would definitely welcome any help on the oauth front! If you wanted to start exploring it
[13:54:27]<mstenta[m]>There are some modules available for D7 that you could experiment with
[13:55:27]<mstenta[m]>You could pop one of those into your install and play around with it
[13:55:39]<mstenta[m]>(Doesn't necessarily need to be officially included in farmOS)
[13:56:05]<mstenta[m]>If we want to consider including it in farmOS in D7, we'll just need to think through the D8 upgrade path
[13:57:35]<paul121[m]>Makes sense. I may be interested in exploring it! I'm playing around with a decoupled-react based app. Trying to learn React and the farmOS ecosystem. I've been avoiding the current Auth... getting it setup in Postman was messy
[13:58:12]<mstenta[m]>So... there is another in-between option for auth...
[13:58:35]<paul121[m]>If it's as easy as installing the module and doing some configuration, will definitely try and share what I find.
[13:58:37]<paul121[m]>Oh!
[13:58:55]<mstenta[m]>The RESTws module comes with a "Basic authentication" sub-module, which allows you to skip the /user/login authentication and just pass credentials like you would with http basic authentication
[13:59:18]<mstenta[m]>That is actually included in farmOS (because restws is included) but the module is not enabled by default
[13:59:24]<mstenta[m]>So you could turn that on and experiment with it
[14:00:05]<mstenta[m]>I think there's some weird rules with it... like you need to create a user with a special username, or something... it's in the module's README
[14:00:12]<paul121[m]>I tried that, but didn't have any luck. I would just include credentials with every request?
[14:00:44]<mstenta[m]>https://cgit.drupalcode.org/restws/tree/restws_basic_auth/README.txt
[14:00:50]<mstenta[m]>that's the readme
[14:01:24]<mstenta[m]>i haven't tried it myself
[14:01:45]<mstenta[m]>i forget why we decided against that as the recommended approach...
[14:02:04]<mstenta[m]>maybe you'll figure that out :-)
[14:02:42]<paul121[m]>Ahhh. Looks like an easy fix! Just using a restws_username as a 'service' account is easy enough... Thanks!
[14:03:46]<mstenta[m]>Cool! Let me know if you get that working - it would be a good thing to document
[14:04:47]<mstenta[m]>(if you get the urge, and want to add to the API doc page (https://farmos.org/development/api/), that code is here: https://github.com/farmOS/farmOS.org/blob/7.x-1.x/docs/development/api.md)
[14:23:54]<mstenta[m]>(I wonder if using the basic auth approach changes the need for the cookie/token?)
[14:27:08]<paul121[m]>Yeah, this works great. Testing in Postman was easy to setup using their Basic Authentication. It looks like it still returns a cookie, but the cookie isn't needed to authenticate
[14:27:49]<mstenta[m]>oh great!
[14:28:09]<paul121[m]>It's a little hidden how Postman does all of that, though. I'll test some with curl, its a bit more explicit
[14:28:36]<mstenta[m]>ok cool - if you can, document your findings in a github issue at the very least... then we can translate that into the docs later
[14:29:48]<paul121[m]>Will do!
[15:09:31]* JustTB has quit (Ping timeout: 250 seconds)
[15:25:22]* JustTB has joined #farmos
[15:44:37]* JustTB has quit (Ping timeout: 250 seconds)