Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add users to a list in one request #6

Open
fernandopg opened this issue Aug 20, 2015 · 4 comments
Open

Add users to a list in one request #6

fernandopg opened this issue Aug 20, 2015 · 4 comments

Comments

@fernandopg
Copy link
Contributor

Hi @gellu !

I was thinking about to create an api request to add o bunch of users to a list in one request. For example in some cases I need to add like 15k users to a new list and execute 15k request is crazy...

The api request to add one user now is:

POST /subscribers/user/add

I was thinking to add that request:

POST /subscribers/users/add (Content-Type: application/json)
PARAMS:
   list: list id
   users: a json object ej: [{email: xxx, name: yyy}]

Or maybe this other:

POST /lists/subscribers/add (Content-Type: application/json)
PARAMS:
   list: list id
   users: a json object ej: [{email: xxx, name: yyy}]

Examples:

POST /subscribers/users/add (Content-Type: application/json)
{list:2, users: [...]}

POST /lists/subscribers/add (Content-Type: application/json)
{list:2, users: [...]}

Or maybe is better to keep the Content-Type as it is in the other api requests:

POST /subscribers/users/add (Content-Type: application/x-www-form-encoded)
list=2&users=[...]

What do you think? Tell me if you would like to have that in your API and how do you think is better!

@gellu
Copy link
Owner

gellu commented Aug 21, 2015

Good idea:)
I would rather use one route for that
POST /subscribers/user/add
If there is request body containing json list I would add multiple users, in other case (request body empty) to maintain backwards compatibility I would fallback to getting user data from POST.
Listid should be always passed with POST.

@fernandopg
Copy link
Contributor Author

Ok, summarizing;

POST /subscribers/user/add (Content-Type: application/x-www-form-encoded)
PARAMS:
    list: list id
    email: user email (optional)
    name: name email (optional)
    users: [...] (optional)

If the users param exists I use it, if not I use the email and name params.

Examples:

Actual request:
POST /subscribers/user/add (Content-Type: application/x-www-form-encoded)
Body Request: list=1&[email protected]&name=zzz

New request:
POST /subscribers/user/add (Content-Type: application/x-www-form-encoded)
Body Request: list=1&users=[{email:"[email protected]", name:"pepe"}, ...]

That's ok?

@gellu
Copy link
Owner

gellu commented Aug 21, 2015

Yes. Exactly what I had in mind.

@aishwarydhare
Copy link

any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants