Manager API Error 401

Hello, i tried using postman on chrome to test the api but i got error 401
username: administrator
password: ********

any idea why this error occur?

Error 401 would indicate the password is incorrect. I’m not able to reproduce this issue. I can log in as administrator or any other user who has administrator role.

it didn’t indicate any particular reason. just 401 unauthorized.

Two things to try:

Try logging in with the same password using the web interface. Does it work?

Try changing the endpoint to not end with a slash. Try /api instead of /api/

No, actually. You’re not passing in the details correctly!

Don’t enter username and password there. You’ve entered it into the parameters section instead by mistake.

Select “Basic Auth” on the Authorisation tab and you should see two dedicated fields for username and password:

Let us know how you go after trying this :slight_smile:

thanks, i’m in

but response isnt in json :tired_face::tired_face::tired_face: i want to connect manager api to a mobile app, i need json response

You might find it easier to also have your web browser open while you’re playing around with the API, until you become familiar with how it works.

Visit the /api route in your browser and enter your auth details. You’ll see a list of businesses and a file named index.json - it is this file that gives you data in the format you’re looking for.

Try what I suggested above. You can get JSON from the Manager API.

i perfectly understand what you mean but “” does not have a json data

its easy to view list of business using index.json but “” displays
with no json data.

how do i navigate past this page

It is true that the initial endpoint for a business does not have an index.json file. However, you’ll notice that the ID for each of these items is consistent.

For example, if you have two businesses:

The customers tab is at ec37c11e-2b67-49c6-8a58-6eccb7dd75ee.

So for any business, you would access it using this endpoint:

In the same way, Tabs is ac789d1f-034f-4964-a8b5-ebfffc3511f2.

So you could build up a list of constants in your client application, mapping the friendly name that you want to refer to it by, with the relevant ID - then use these constants for any business you access.

e.g. An array:

sections = [
    "Customers" => "ec37c11e-2b67-49c6-8a58-6eccb7dd75ee",
    "Tabs"      => "ac789d1f-034f-4964-a8b5-ebfffc3511f2",
    // ...

This will make it easier for you to construct the URL you need:

endpoint = "https://<domain>/api/<business>/" + sections['Tabs'] + "/index.json";

very detail explanation, thanks :slightly_smiling_face::slightly_smiling_face: bookmarking the page

You marked your own answer as solution! :stuck_out_tongue:

Please note that the API is in development, and may change in future. For example, a recent change split the Bank and Cash Accounts into separate tabs.

The side effect of this recent change is that it also affected the API, because that initial endpoint for a business is based on the tabs that are available and contain data.

So when tabs change on the front-end, the way you access data in the API back-end changes also. Just be prepared to make occasional fixes to your API client if you’re keeping the server up to date. Cloud Edition updates itself regularly, so a change might take you by surprise.

okay, thanks again