Giter VIP home page Giter VIP logo

Comments (9)

ErisDS avatar ErisDS commented on July 28, 2024 2

With the current SDK design I found that ambiguous. There are arguments for host and ghostPath - in the case of a sub-directory install which argument should the subdirectory path element be added to?

Good questions.

ghostPath is a stopgap solution for us having hardcoded /ghost/ in the SDK, so that in future when this does become customisable, it's an extra config option already. It's not documented in the Content SDK: https://docs.ghost.org/api/javascript/.

host should be your admin URL including any subdirectory, although perhaps host wasn't the best name πŸ€”

This does me back to my previous suggestion about having host listed on the integration screen, to make it absolutely clear what to paste into this field cc @peterzimon

from sdk.

kevinansfield avatar kevinansfield commented on July 28, 2024 1

This does me back to my previous suggestion about having host listed on the integration screen, to make it absolutely clear what to paste into this field cc @peterzimon

If we do this then we can update the Zapier auth screen too so it has an "API Host" field rather than "Admin URL", seems like that will be more future-proof too.

@peterzimon it's worth noting that the Ghost Admin changes would need to be made in two places, the Custom Integration and the Zapier screen.

Custom Integration screen:

  • add Admin API Key field (currently behind experiments flag)
  • add Admin API URL field

Zapier Integration screen:

  • add Admin API Key field
  • add Admin API URL field

"Admin API URL" or "API Host" naming is not decided πŸ™‚

Within Zapier's own "Connect Account" screen we can use the same field names so that it's really obvious that you copy the contents of each field across.

from sdk.

ErisDS avatar ErisDS commented on July 28, 2024

We don't currently do this for the content API, leaning towards throwing errors until the correct URL is provided.

The reasoning behind this, is that people interacting with our SDK tools are developers, and developers have a better experience when they understand what's happening beneath them. E.g. tell them to enter https, don't magically change http to https without them knowing.

Zapier is a very interesting client example, because in this case, Kevin is the developer of a shared client, and people interacting with the shared client (Zapier) are users. Users have significantly less tolerance for errors as well as less interest in what's happening under the hood, so for users, magic is more desirable.

This is always a fine balance to tread.

In this case, I think at least right now, that it makes sense that Kevin as the developer of a client for non developer users has to handle some extra logic, but:

  • Are we able to validate the URL in Zapier at all? E.g. to ensure we're handed HTTPS.
  • ghostPath is currently not editable, so I don't think you have to account for that right now.

The slash / no slash is the one thing where maybe we should handle it in the admin-api tool, cos it's something most people don't notice. It's an implementation detail of Ghost, not an important distinction like the fact that admin URLs must be https.

from sdk.

kevinansfield avatar kevinansfield commented on July 28, 2024

Users have significantly less tolerance for errors as well as less interest in what's happening under the hood, so for users, magic is more desirable.

πŸ‘ agreed. Good point on the desired audience for each tool.

  • Are we able to validate the URL in Zapier at all? E.g. to ensure we're handed HTTPS.

Yes, that's doable πŸ‘

  • ghostPath is currently not editable, so I don't think you have to account for that right now.

With the current SDK design I found that ambiguous. There are arguments for host and ghostPath - in the case of a sub-directory install which argument should the subdirectory path element be added to? The strict leading/trailing slash complicates this because if you have a sub-directory install I think it's common to say your "host" would be https://mysite.com/blog/ rather than https://mysite.com/blog (I was actually tripped up by this and took the ghostPath to be the full path to ghost incl. the subdir so used that argument instead of appending the non-trailing-slash subdir onto host)

from sdk.

kevinansfield avatar kevinansfield commented on July 28, 2024

I think if we expose an "Content/Admin API URL" in the in the integrations screen we can also simplify the SDK arguments so that only a URL is passed in.

new GhostAdminAPI({url: 'https://mysite.com/ghost/api/', version: 'v2', key: 'xxx'}). I don't see why the ghostPath argument is necessary, it seems like it's an internal implementation detail that even developers shouldn't need to care about, if it's only about validation then we can do that just as easily with a URL without needing to make the arguments more confusing.

If a URL can be provided then it's also future-proof as it allows for any part of the URL to be changed if it's configurable later on, eg. I have my API configured to live at https://api.mysite.com/ πŸ€” but my "admin" SPA lives on https://admin.mysite.com.

from sdk.

peterzimon avatar peterzimon commented on July 28, 2024

@kevinansfield
Here's how we should change the custom integration screen in Ghost Admin.

custom-integrations-update

Notes:

  • "Copy" button appears only on row hover (similarly to current version)
  • "Copied to clipboard" should flash temporarily instead of the key/URL value in the given row
  • we can reuse the same design for the Zapier integration screen and extend it with a little help to bring attention that these values will be needed on Zapier connect

from sdk.

ErisDS avatar ErisDS commented on July 28, 2024

Should we maybe add url to both the content and admin sdk, and deprecate host - remove it from docs, have it work for now, remove it whenever we have a good moment?

from sdk.

kirrg001 avatar kirrg001 commented on July 28, 2024

@kevinansfield What is the state of this issue? Is it done?

from sdk.

kevinansfield avatar kevinansfield commented on July 28, 2024

The UI side of things in Ghost-Admin is done. @ErisDS's suggestion for swapping host (with deprecation) for url sounds good, I'll confirm and implement.

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.