How to create a new business after a user is already created


#1

Hi there,
I’ve successfully created a user. Then when I create a business using Advanced Rest Client, I get a Authentication pop up request. What do I need to put in here? I thought that all I had to do was to put the User’s API key into the username via basic authentication.

My end points are:
https://9spokes.yourpayroll.com.au/api/v2/business
Authorization: Basic [hidden]
Body:
{
“name”: “Jackie Chan Chemist”,
“abn”: “53004085616”,
“contactName”: “Sean”,
“contactEmailAddress”: "kungfuchow1@gmail.com",
“standardHoursPerDay”: 8,
}

The API key that was returned when I created the user kungfuchow1@gmail.com is: [hidden]

Cheers,
Sean


#2

Hi Sean,

It looks like there’s an issue with the /User API call at the moment that isn’t setting the API key properly when the users are being created.

I’ll arrange to get a fix deployed, but in the meantime, to continue testing, could you re-generate the API key manually (see API Key Authentication) and I’ll be sure to notify you as soon as this is resolved.

Apologies for the inconvenience.

Regards
Phil


#3

Thanks for the reply Paul. So this is where I get confused. I create users based on my Whitelabel admin API key. That’s all good. I then get returned a User API key that is used in all subsequent interactions with the API. Again all good.

The link provided to re-generate the API key manually (API Key Authentication), looks like I’m re-generating the Whitelabel admin API key. I’m not clear how this helps me? I think I’m missing something.

Cheers,
Sean


#4

Hey Sean,

Sorry, I should have been clearer in my response. Your understanding of how the API works is 100% correct.

What I meant was to log in as "kungfuchow1@gmail.com" (either using username / password login or SSO login) and regenerate the API key manually for the "kungfuchow1@gmail.com". Once you regenerate his API Key you can use that for creating a business for "kungfuchow1@gmail.com".

I’ll let you know when the fix for the API Key being saved has been resolved (shouldn’t be too long)

PB


#5

Hi Sean,

We’ve deployed a fix for this now so it should work correctly for new users you create via the API, but you will still need to manually re-create the api key for "kungfuchow1@gmail.com"

Apologies for the issue and thanks for bringing it to our attention.

PB


#6

Thanks. All good. (Posts need to be more than 20 chars).