activecollab-feather-sdk icon indicating copy to clipboard operation
activecollab-feather-sdk copied to clipboard

Remove /projects from example endpoints

Open falsovsky opened this issue 6 years ago • 2 comments

Hi there,

In your self hosted examples, you have the endpoint as "https://my.company.com/projects", but if you try to add any server based on that example (Eg. "https://zbr.blah.com/projects"). You always get:

Invalid response from "https://zbr.blah.com/projects/api/v5/issue-token". JSON expected, got "text/html;charset=UTF-8", status code "200"

After searching for that error, I've found this closed issue with the solution from 2018: https://github.com/activecollab/activecollab-feather-sdk/issues/18

That specifies that the endpoint URL shouldn't have the /projects suffix, but in your README and self hosted examples its still that way.

Here is a PR that changes the examples to make them work again.

falsovsky avatar Sep 09 '19 15:09 falsovsky

I also think that the API should automatically be set to 5 in here: https://github.com/activecollab/activecollab-feather-sdk/blob/master/src/Authenticator/SelfHosted.php#L29

If you want, I'll open another PR.

falsovsky avatar Sep 09 '19 15:09 falsovsky

Correct version of ActiveCollab API is v1, not v5. API version is not tied to version of the self-hosted package. If there's a major change to the way API works, we'll bump the version to v2, regardless of the version of self-hosted package.

Therefore, you should use URL's like /api/v1/issue-token, not /api/v5/issue-token.

Regarding /projects problem in the referenced issue, it was error of base URL, not the SDK. You can install ActiveCollab on all sorts of places:

  1. Domain, like myprojects.com, in which case API will be myprojects.com/api/v1,
  2. Subdomain projects.mycompany.com, in which case API will be projects.mycompany.com/api/v1,
  3. Sub-directory mycompany.com/projects, in which case API will mycompany.com/projects/api/v1

etc. Examples are what most people were doing at the time of writing (installing ActiveCollab in sub-directory on their company's website).

ilijastuden avatar Sep 21 '19 09:09 ilijastuden