Jump to content

Weekly update – 3 February 2023


ryan
 Share

Recommended Posts

These last few weeks I've been working on integrating a ProcessWire installation with the Fareharbor API for a client. Other than the authentication part (which is as simple as it gets), I've found this API to be one of the more time consuming ones to work with. It's not so much that the API is difficult to use, as much as it is just a time sink, taking a long time to reorganize the info it provides into something useful for our needs. And likewise taking a long time to prepare information to put back into it in the format it requires. My best guess is that it is an echo of an existing back-end API, projecting internals rather than tailoring a simpler public API to them. Perhaps it's an interface optimized for the some internal legacy system rather than the external consumers of it. Or perhaps it already is a lot simpler than what's behind it, and its interface has been carefully considered (even if it doesn't feel that way), who knows.

To be fair, no API is perfect, and this particular API does provide a working and reliable interface to some pretty complex data, and an immense amount of power. It's good to work with lots of different APIs, from easy-to-painful, as it helps to clarify paths to take (and to avoid) when authoring new APIs. I ended up building an adaptor module in ProcessWire just to give this particular API a simpler interface that was more useful to the needs we had, and that is now saving us a lot of time. It reminded me of one reason why ProcessWire was built in the first place, to create a simple interface to things that are not-so-simple behind the scenes, and I think we've been pretty successful with that. We'll keep doing that as ProcessWire continues to mature, evolve and grow, as we always have. 

In terms of core updates, commits this week were similar to those from the last couple of weeks: a combination of issue fixes, a PR, feature requests and minor improvements. We are now 17 commits past 3.0.211, but I'm going to wait till next week before bumping the version to 3.0.212, as there's a little more I'd like to add first. Thanks for reading this update and I hope that you have a great weekend! 

  • Like 15
  • Thanks 3
Link to comment
Share on other sites

1 hour ago, ryan said:

It's not so much that the API is difficult to use, as much as it is just a time sink, taking a long time to reorganize the info it provides into something useful for our needs.

Almost every time. I think we're just a bit spoiled with the PW API, but it is always a bit of a shock to work with API data that needs to be wrestled into shape before we can do what we want to do. I'm not sure I could even wrestle it into shape if it wasn't for PW.... On the plus side, at least that API is documented and returning JSON ? 

  • Like 3
Link to comment
Share on other sites

@nbcommunication Yes, you are right, it's nice it's working with JSON, and nice that it's well documented. These things already make it well above average. Despite being simple to consume JSON, one thing I find a bit painful is the lack of granularity in the API. There's a lot of cases where I want to get one thing or another, but I have to get the entire 800kb structure of things and parse the one thing I need out of it. It seems like this will just not be feasible at some scale. When it comes to putting data into the system, you have to construct a large JSON object and manipulate it as a whole rather than being able to insert or modify individual parts. Maybe this is standard for APIs like this, I don't know. It seems cumbersome at times. 

  • Like 1
Link to comment
Share on other sites

There's tradeoffs between maintainability and controllable surface area vs. flexibility. The more options available the more permutations of options there are. More permutations of options make downstream concerns more tricky like caching, authentication, internal querying, …. Just need to look at the issues with deploying a graphql API at scale, where graphql sits rather close to the flexibilit end of the mentioned scale.

  • Like 2
Link to comment
Share on other sites

@ryan

What I love about PW is that you can do the craziest projects with it. The flexibility of PW allows you to implement anything from a payment terminal to an e-book with maps. And even the older versions remain reliable and work as designed. I have PW version 2.3 running somewhere - no complaints from customers. This is a genius invention. Thanks.

I hope to post a new project on PW here soon that implements a remote medical equipment management system.

  • Like 4
Link to comment
Share on other sites

@bernhard

17 hours ago, bernhard said:

Would be nice to know how old that site is ? 

It wasn't really a website. It's a catalog of machine parts for the company. We were then looking for a CMS that could display the hierarchical structure of the catalog well. In addition, we needed the templates to have a different structure for different types of parts. One of our young programmers at the time said: there is a great American CMS - ProcessWire, it is perfect for our task. That was in 2012. In any case, we finished this project in 2012. 
I found a backup now. We used ryancramerdesign-ProcessWire v 2.2

In 2013, we moved our windsurfing store project from a self-described CMS to PW 2.4. By the way, the self-written CMS has been around since 2000. At that time @Soma cheatsheet helped us much. We still maintain that project, but have updated PW each time for new features from @ryan

Back then, there was no PW module for a full-fledged store. But in 2012, @apeisa published an example of such a module Shop-for-ProcessWire. We took it as a basis and now it is a working online shop.

In fact, I made my first site in 1994, and it is now also converted to PW. It was such a long story with a happy ending.

  • Like 7
Link to comment
Share on other sites

@ryan have you ever worked with any products from cdata?

https://www.cdata.com/apiserver/

Not that you are addressing this issue, but if you come across older on-prem data sources or other weird solutions that need an API wrapper that you can configure with a pretty straightforward JSON configuration, their stuff works nicely.

They also have interesting interfaces that allow you to configure API calls and behaviors with JSON settings to then get acted upon with SQL like a database.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...