Date   

Re: Help on auth that isn't using curl #api

Zawiya
 

For anyone interested in how to prep the header manually using JavaScript:
base64Token = Buffer.from(token + ':').toString('base64')
Then the header can be a simple string:
header = `Authorization: Basic ${base64Token}`
This is how I had to do it for Budibase
All the best


Re: A Lesson I Just Learned...

Zawiya
 

I got the solution, sorry to bother
https://beta.groups.io/g/api/message/289


Re: Help on auth that isn't using curl #api

Zawiya
 

On Wed, Nov 30, 2022 at 07:18 PM, Eric Searcy wrote:
auth=HTTPBasicAuth(str(token), "")
Thank you all for your responses, the above from Eric did the trick, and yes I do prefer to use the token, and need to when using budibase (which I also got working!)

When I was testing HTTPBasicAuth, I was putting None in the second parameter not an empty string!

Thanks again!!


Re: Help on auth that isn't using curl #api

Eric Searcy
 

There are two auth modes: cookie or token (our implementation has used both in the past but we have a preference for tokens). Zawiya included "token": "true" in their request which returns a token.

The token should get set as the basic auth username, and there is no basic auth password.

Try passing this as your auth argument. The csrf is NOT required when using token authentication against documented API endpoints; you can remove that from params argument.

auth=HTTPBasicAuth(str(token), "")

-Eric

On 11/30/22 9:06 AM, Andy Wedge wrote:

On Wed, Nov 30, 2022 at 02:28 PM, Zawiya wrote:
So when I login, it works and I get both the csrf_token and the login token from the response.
I just get stuck on how I should formulate the "header" of the request so that the auth works.
On my post requests, I specify the cookies too. Here are a few lines from one of my Python scripts that I use to change member colours if it helps:

def _login():
    print("Logging in to Groups.io...")
    global r
    f = open("groupsio_login.dat", "r")         # Read userid & password from a file
    login_id        = f.readline()
    login_password  = f.readline()
    f.close()
    login_parms = { "email"     : login_id,
                    "password"  : login_password
                  }
    r = requests.get("https://groups.io/api/v1/login",
                 params=login_parms)
    reqD = r.json()
    csrf = reqD['user']['csrf_token']
    return csrf, r.cookies
--
csrf, cookies = _login()                # Login to Groups.io
if not r:
    print('Login failed.', r.status_code, r.reason)
    quit()
--
update_parms = {}
update_parms["group_name"] = group_name
update_parms["csrf"] = csrf
changed_colour = 0

for m in groupMembersL:
        print("**")
        print("Changing colour for", m['full_name'], m['email'], "from", m['color'], "to", memberColoursD[memberStatusD[m['email'].casefold()]])
        update_parms['member_info_id'] = m['id']
        update_parms["color"] = memberColoursD[memberStatusD[m['email'].casefold()]]
        r = requests.post("https://groups.io/api/v1/updatemember",
                           data=update_parms,
                           cookies=cookies)
        if r:
            print('Request successful.')
            changed_colour+=1
        else:
            print('Request failed.', r.status_code, r.reason)
--

Regards
Andy


Re: Help on auth that isn't using curl #api

Andy Wedge
 

On Wed, Nov 30, 2022 at 02:28 PM, Zawiya wrote:
So when I login, it works and I get both the csrf_token and the login token from the response.
I just get stuck on how I should formulate the "header" of the request so that the auth works.
On my post requests, I specify the cookies too. Here are a few lines from one of my Python scripts that I use to change member colours if it helps:

def _login():
    print("Logging in to Groups.io...")
    global r
    f = open("groupsio_login.dat", "r")         # Read userid & password from a file
    login_id        = f.readline()
    login_password  = f.readline()
    f.close()
    login_parms = { "email"     : login_id,
                    "password"  : login_password
                  }
    r = requests.get("https://groups.io/api/v1/login",
                 params=login_parms)
    reqD = r.json()
    csrf = reqD['user']['csrf_token']
    return csrf, r.cookies
--
csrf, cookies = _login()                # Login to Groups.io
if not r:
    print('Login failed.', r.status_code, r.reason)
    quit()
--
update_parms = {}
update_parms["group_name"] = group_name
update_parms["csrf"] = csrf
changed_colour = 0

for m in groupMembersL:
        print("**")
        print("Changing colour for", m['full_name'], m['email'], "from", m['color'], "to", memberColoursD[memberStatusD[m['email'].casefold()]])
        update_parms['member_info_id'] = m['id']
        update_parms["color"] = memberColoursD[memberStatusD[m['email'].casefold()]]
        r = requests.post("https://groups.io/api/v1/updatemember",
                           data=update_parms,
                           cookies=cookies)
        if r:
            print('Request successful.')
            changed_colour+=1
        else:
            print('Request failed.', r.status_code, r.reason)
--

Regards
Andy


Re: A Lesson I Just Learned...

Zawiya
 

Hi thanks for this, I just learned that today also, however I'm stumped on how to get auth working for python.
I'm logging in, getting the csrf_token and the login token, but the next request I call e.g. "send invite" is failing with unauthorized.

Is there any guidance you can provide?

Omar


Help on auth that isn't using curl #api

Zawiya
 

Hi, thanks for this amazing product and opening up an api to it.

I'm using a tool called budibase to allow people to fill in a form and I'd like to add the ability for me to invite them to a group using the API.

I couldn't get it authorizing so I tried a python script and still can't get it going:
from pprint import pprint
import requests
from requests.auth import HTTPBasicAuth

response = requests.post(
    'https://groups.io/api/v1/login',
    params={
        "email": "<email>",
        "password": "<password>",
        "token": "true"
    }
)

response_json = response.json()

token = response_json.get('token')
csrf_token = response_json.get('user').get('csrf_token')

print(token, csrf_token, sep="\n")

response = requests.post(
    "https://groups.io/api/v1/invite",
    params={
        "group_name": "<group-name>",
        "emails": "<emails>",
        "csrf": csrf_token
    },
    auth=HTTPBasicAuth("<email>", f"{token}")
    # headers={'Authorization': f"Basic {token}"}

)
response_json = response.json()
pprint(response_json)
So when I login, it works and I get both the csrf_token and the login token from the response.
I just get stuck on how I should formulate the "header" of the request so that the auth works.

I tried:
Authorization: Basic <token>

But that's not working.

Thanks for your time and apologies if this has been answered over and over, I did a search and I only found references to curl, and .NET, but neither helped me figure this out.

Omar


Preliminary support for setting/updating extra member data #api

 

Hi All,

I've just pushed preliminary support for setting/updating extra member data via the /updatemember endpoint. I've also updated the API docs, It currently does not support setting/updating image columns.

Please let me know if you have any questions or suggestions for how to improve it (especially the docs; it's kind of complicated).

Thanks,
Mark


Re: Getactivitylog endpoint not working for subgroups #bug

 

On Wed, Jul 6, 2022 at 7:48 AM Andy Wedge <andy_wedge@...> wrote:

when I call the getactivitylog endpoint with a subgroup name as the group_name parameter I get the following response:

{"object":"error","type":"bad_request","extra":"not a parent group"}

This should be fixed now.

Thanks,
Mark 


Getactivitylog endpoint not working for subgroups #bug

Andy Wedge
 

Hi Mark,

when I call the getactivitylog endpoint with a subgroup name as the group_name parameter I get the following response:

{"object":"error","type":"bad_request","extra":"not a parent group"}

Is there a reason why this endpoint seems to be restricted to main groups?

Regards
Andy


Re: Restrict_date values on getactivitylog endpoint #suggestion

 

On Thu, Jun 30, 2022 at 12:09 PM Andy Wedge <andy_wedge@...> wrote:

the 'today' value for the restrict_date parameter on the getactivitylog endpoint actually returns entries from the last 24 hours. The filter on the website was changed from 'today' to 'past 24 hours' to be more precise (see #80681206). Can the API be changed from 'today' to 'last_24_hours' to be more precise and match the naming convention of other possible values such as 'last_week' and 'last_30_days'?

I've made this change.

Thanks,
Mark 


Restrict_date values on getactivitylog endpoint #suggestion

Andy Wedge
 

Hi Mark,

the 'today' value for the restrict_date parameter on the getactivitylog endpoint actually returns entries from the last 24 hours. The filter on the website was changed from 'today' to 'past 24 hours' to be more precise (see #80681206). Can the API be changed from 'today' to 'last_24_hours' to be more precise and match the naming convention of other possible values such as 'last_week' and 'last_30_days'?

Thanks
Andy


Endpoints to add and update events #misc

Andy Wedge
 

Hi Mark,

are there any endpoints to add, update & delete events in the pipleline? I was looking to write a script that would allow me to copy/move events from one group to another to save typing and copying and pasting text.

Regards
Andy


Re: Updatemember endpoint query #misc

Andy Wedge
 

On Mon, Jun 13, 2022 at 08:45 PM, Mark Fletcher wrote:
you're specifying the parameters as part of the URL
Yes, I had the POST with params= when it should have been data=.  It's working now and I get the expected entries on the activity log.

Thanks,
Andy


Re: Updatemember endpoint query #misc

 



On Mon, Jun 13, 2022 at 12:19 PM Andy Wedge <andy_wedge@...> wrote:
Hi Mark,

following on from my last message about membership colours, I've been reading the API documentation and creating a Python script to use it. I can retrieve member details but am failing to update them. A call to the updatemember endpoint returns a 200 code though so I am not sure why it does not work. The member info object returned after the post to the updatemember endpoint shows the same details that were initially retrieved.

The following debug output from my script shows the calls made and parameters used. (some details redacted):

Getting member details...
https://groups.io/api/v1/getmember?member_info_id=1nnnn194&group_name=xxxx%2Btest


You're doing a POST call, which is correct, but you're specifying the parameters as part of the URL, which is what you do with a GET call. So the code is never seeing your color argument.

Hope this helps.
Mark 


Updatemember endpoint query #misc

Andy Wedge
 

Hi Mark,

following on from my last message about membership colours, I've been reading the API documentation and creating a Python script to use it. I can retrieve member details but am failing to update them. A call to the updatemember endpoint returns a 200 code though so I am not sure why it does not work. The member info object returned after the post to the updatemember endpoint shows the same details that were initially retrieved.

The following debug output from my script shows the calls made and parameters used. (some details redacted):

Getting member details...
https://groups.io/api/v1/getmember?member_info_id=1nnnn194&group_name=xxxx%2Btest
Response code: 200
Request is successful.
Current member details...
Id: 1nnnn194
Full Name: Andy Wedge (G)
Email: axxxxxxxxx@...
Color: color_green_lantern
Postng member details...

https://groups.io/api/v1/updatemember?member_info_id=1nnnn194&group_name=xxxx%2Btest&csrf=7nnnnnnnnnnnnnnnnn6&color=color_mustard
Response code: 200
Request is successful.
Updated member details...
Id: 1nnnn194
Full Name: Andy Wedge (G)
Email: axxxxxxxxnx@...
Color: color_green_lantern

What am I missing?

If the call was successful and an update was made, I would have expected to see something on the activity log but there is nothing there.

Thanks
Andy


Re: API use with free groups #api

 

On Tue, May 31, 2022 at 9:31 AM Richard Waller <wallerr@...> wrote:

We are developing an integration between Wordpress and groups.io where we have an existing, live group. I don't want to develop and test against the live group (obviously). So the questions are:

  1. Does the API work with a free group?
  2. If it does, is the functionality limited to that for a free group (e.g. no ability to Direct Add)?
  3. If the API functionality is restricted for a free group does anyone have any suggestions for how best to do development/testing without having to create a new paid account?

The API does work with a free group. The API only allows the same functionality as what you get on the website, so no Direct Add for free groups, for example.

Unfortunately, we don't currently have an API sandbox for testing.

Thanks,
Mark 


API use with free groups #api

Richard Waller <wallerr@...>
 

Hi,

We are developing an integration between Wordpress and groups.io where we have an existing, live group. I don't want to develop and test against the live group (obviously). So the questions are:

  1. Does the API work with a free group?
  2. If it does, is the functionality limited to that for a free group (e.g. no ability to Direct Add)?
  3. If the API functionality is restricted for a free group does anyone have any suggestions for how best to do development/testing without having to create a new paid account?
I realise I can simply create another paid account but I work for a very small organisation where every expenditure is carefully scrutinised!

Thanks,

Richard

P.S. apologies if you got a previous version of this enquiry with a tag - I haven't used tags before so didn't realise what I needed to do...


Color names #important

 

Hi All,

I have changed how we handle colors internally. Where this will be seen is in the API and in any exported JSON files (when you export a group or a database table).

Previously, color names in the API and through exported JSON files started with either tag_ or column_color_. Now all color names just start with color_.

If you have a JSON database table export that you wish to re-import at some point, simply doing a search/replace on the color names will ensure that the proper colors are imported.

Please let me know if you have any questions.

Thanks,
Mark


Re: Get Events Limit #api

Seth Tartar
 

Hello Mark,

It is not an issue for my use case but noticed it as I was testing and so wanted to bring it to your attention since the start / end response elements appear to be reflecting the limit while the returned data shows otherwise. 

Thanks,
Seth

On Fri, Apr 22, 2022 at 11:25 Mark Fletcher <markf@corp.groups.io> wrote:
Hi Seth,

I apologize for not getting back to you sooner. Yes, this is currently expected behavior (and as I see, it is not noted in the docs. I will change that). My thinking was that if you specify a start and end date, that you want all events within that interval. 

Is ignoring the limit an issue for you?

Thanks,
Mark

--
Seth - KD0TEL

1 - 20 of 290