Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Update to support API 3.0 & Swift example #14

Open
acegreen opened this issue Jan 10, 2016 · 13 comments
Open

Update to support API 3.0 & Swift example #14

acegreen opened this issue Jan 10, 2016 · 13 comments

Comments

@acegreen
Copy link

It would be greatly appreciated if we can update this library for the new API.

Also a swift example with completion block would be awesome too.

@fabreax
Copy link

fabreax commented Jan 18, 2016

I'm also looking for a swift sample ;)

@fabreax
Copy link

fabreax commented Jan 20, 2016

This is a functional sample :

ChimpKit.sharedKit().apiKey = "your api key"
let params:[NSObject : AnyObject] = ["id": "your list id", "email": ["email": "[email protected]"]]
ChimpKit.sharedKit().callApiMethod("lists/subscribe", withParams: params, andCompletionHandler: {(response, data, error) -> Void in
            if let httpResponse = response as? NSHTTPURLResponse {
                NSLog("Reponse status code: %d", httpResponse.statusCode)
            }
})

@acegreen
Copy link
Author

@fabreax thanks for the help. I got it all setup and works perfectly.

@acegreen
Copy link
Author

Is there any way we can subscribe them so they don't have to confirm the email?

@fabreax
Copy link

fabreax commented Jan 21, 2016

You should look at the "double_optin" parameter : https://apidocs.mailchimp.com/api/2.0/lists/subscribe.php

@fabreax
Copy link

fabreax commented Jan 21, 2016

I think the API is still 2.0

I tried the double_optin parameter, I don't receive a confirmation email with :
let params:[NSObject : AnyObject] = ["id": listId, "email": ["email": email], "double_optin": false]

@acegreen
Copy link
Author

Not sure what is meant by this: "I think the API is still 2.0"

  1. MailChimp is still on 2.0 -> issue should remain closed
  2. ChimpKit is still on 2.0 -> issue needs to be reopened.

When checking the 2.0 docs, I get the following alert at the top of my view
screen shot 2016-01-21 at 9 38 48 am

@fabreax
Copy link

fabreax commented Jan 21, 2016

I'm not the developer of this library. They say "ChimpKit is an API wrapper for the MailChimp API 2.0.".

@acegreen
Copy link
Author

Yea I saw that too. Ok so you are saying we should reopen this issue since its still valid. Cheers

@acegreen acegreen reopened this Jan 21, 2016
@mozeb
Copy link

mozeb commented Nov 3, 2016

Here is SWIFT 3 working example of subscribing user without email confirmation:



ChimpKit.shared().apiKey = "your_API_key"
    let mailToSubscribe: [String: AnyObject] = ["email": "mail_you_want_to_subscribe" as AnyObject]
            let params: [String: AnyObject] = ["id": "your_list_id" as AnyObject, "email": mailToSubscribe as AnyObject, "double_optin": false as AnyObject]
            ChimpKit.shared().callApiMethod("lists/subscribe", withParams: params, andCompletionHandler: {(response, data, error) -> Void in
                if let httpResponse = response as? HTTPURLResponse {
                    NSLog("Reponse status code: %d", httpResponse.statusCode)
                    let datastring = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
                    print(datastring) // printing result of response
                }
            })

@jlaws
Copy link

jlaws commented Jan 4, 2017

Any update on moving to the 3.0 API? The documentation for 2.0 is no longer accessible via the website linked in the README: https://developer.mailchimp.com/

@anushkmittal
Copy link

bump

@shubham14896
Copy link

Thanks @mozeb

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

No branches or pull requests

6 participants