Incorrect API Key

Options

I set the API key in my post data as the same one as I set in the Site Options.

https://secure2.convio.net/CLIENT/site/SRConsAPI?api_key=554596D320004366A038F0DA1623A732&v=1.0&no_welcome=f&email.accepts_email=t&method=create&email.primary_address=rvuscdprxwzv%40mailinator.com

This worked fine in the test center at http://open.convio.com however its not in our .NET code.

I'm just trying to signup a user to the email list.

Thanks,

Tagged:

Comments

  • I would recommend opening a case on the support site. If it is working in test but not appearing your code, I think you should probably go over it with a technician. Hope that helps a bit!

    https://ssl.salesforce.com/sserv/login.jsp?orgId=00D000000009LHQ

  • On second thought, I went in and checked your API configuration on the Convio side. You had the CONVIO_API_IP_FILTER property set to 69.104.13.244 but it needs to include an IP and a netmask: 69.104.13.244/24

    Try that out and let me know if it works.

    Message was edited by: Bruce Keilin

  • Bruce Keilin:

    On second thought, I went in and checked your API configuration on the Convio side. You had the CONVIO_API_IP_FILTER property set to 69.104.13.244 but it needs to include an IP and a netmask: 69.104.13.244/24

    Try that out and let me know if it works.

    Message was edited by: Bruce Keilin

    So that didn't work.

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Net;

    using System.IO;

    namespace TestConvio

    {

    class Program

    {

    static void Main(string[] args)

    {

    Console.Write(SubscribeUserToConvio("rahul10001@mailinator.com"));

    Console.ReadKey();

    }

    protected static string SubscribeUserToConvio(string emailAddress)

    {

    string convioApiLocation = "https://secure2.convio.net/CLIENT/site/SRConsAPI";

    string convioApiKey = "KEY";

    string convioApiVersion = "1.0";

    string postData = "?api_key="+convioApiKey;

    postData = "&v="convioApiVersion;

    postData += "&no_welcome=f";

    postData += "&email.accepts_email=t";

    postData += "&method=create";

    postData = "&email.primary_address="emailAddress.Replace("@,%40");

    return Post(convioApiLocation, postData)+convioApiLocation + postData;

    }

    protected static string Post(string url, string postData)

    {

    byte[] buffer = Encoding.UTF8.GetBytes(postData);

    int bufferLength = buffer.Length;

    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);

    request.Method = "POST";

    request.ContentLength = bufferLength;

    string result;

    using (Stream requestStream = request.GetRequestStream())

    {

    requestStream.Write(buffer, 0, bufferLength);

    try

    {

    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())

    {

    using (Stream responseStream = response.GetResponseStream())

    {

    using (StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8))

    {

    result = readStream.ReadToEnd();

    }

    }

    }

    }

    catch (WebException wEx)

    {

    using (Stream errorResponseStream = wEx.Response.GetResponseStream())

    {

    using (StreamReader errorReadStream = new StreamReader(errorResponseStream, Encoding.UTF8))

    {

    result = errorReadStream.ReadToEnd();

    }

    }

    }

    }

    return result;

    }

    }

    }

  • johnbrian.mccarthy user_10770_lastname_invali:

    So that didn't work.

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Net;

    using System.IO;

    namespace TestConvio

    {

    class Program

    {

    static void Main(string[] args)

    {

    Console.Write(SubscribeUserToConvio("rahul10001@mailinator.com"));

    Console.ReadKey();

    }

    protected static string SubscribeUserToConvio(string emailAddress)

    {

    string convioApiLocation = "https://secure2.convio.net/CLIENT/site/SRConsAPI";

    string convioApiKey = "KEY";

    string convioApiVersion = "1.0";

    string postData = "?api_key="+convioApiKey;

    postData = "&v="convioApiVersion;

    postData += "&no_welcome=f";

    postData += "&email.accepts_email=t";

    postData += "&method=create";

    postData = "&email.primary_address="emailAddress.Replace("@,%40");

    return Post(convioApiLocation, postData)+convioApiLocation + postData;

    }

    protected static string Post(string url, string postData)

    {

    byte[] buffer = Encoding.UTF8.GetBytes(postData);

    int bufferLength = buffer.Length;

    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);

    request.Method = "POST";

    request.ContentLength = bufferLength;

    string result;

    using (Stream requestStream = request.GetRequestStream())

    {

    requestStream.Write(buffer, 0, bufferLength);

    try

    {

    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())

    {

    using (Stream responseStream = response.GetResponseStream())

    {

    using (StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8))

    {

    result = readStream.ReadToEnd();

    }

    }

    }

    }

    catch (WebException wEx)

    {

    using (Stream errorResponseStream = wEx.Response.GetResponseStream())

    {

    using (StreamReader errorReadStream = new StreamReader(errorResponseStream, Encoding.UTF8))

    {

    result = errorReadStream.ReadToEnd();

    }

    }

    }

    }

    return result;

    }

    }

    }

    I found out my correct CIDR address... 69.104.13.241/28

    Added the Convio API Admin user as this document suggests : http://customer.convio.com/site/PageServer?pagename=Help_Admin_ConvioAPIs_SiteConfig

    And retried my code with two added fields for the user name and password..

    string postData = "?api_key="+convioApiKey;

    postData = "&v="convioApiVersion;

    postData += "&no_welcome=f";

    postData += "&email.accepts_email=t";

    postData += "&method=create";

    postData = "&email.primary_address="emailAddress.Replace("@,%40");

    postData += "&login_name=" + convioLoginName;

    postData += "&login_password=" + convioLoginPassword;

    Still no go.

    Rahul

  • johnbrian.mccarthy user_10770_lastname_invali:

    I found out my correct CIDR address... 69.104.13.241/28

    Added the Convio API Admin user as this document suggests : http://customer.convio.com/site/PageServer?pagename=Help_Admin_ConvioAPIs_SiteConfig

    And retried my code with two added fields for the user name and password..

    string postData = "?api_key="+convioApiKey;

    postData = "&v="convioApiVersion;

    postData += "&no_welcome=f";

    postData += "&email.accepts_email=t";

    postData += "&method=create";

    postData = "&email.primary_address="emailAddress.Replace("@,%40");

    postData += "&login_name=" + convioLoginName;

    postData += "&login_password=" + convioLoginPassword;

    Still no go.

    Rahul

    What do you get back from your POST? Also, I'm not entirely sure you are POSTing properly. It looks like a GET query string and not exactly like POST data (e.g. you shouldn't have a leading ?. Might be worthwhile inspecting the HTTP traffic (using something like Charles) to make sure it's properly formatted.

  • For the record, the problem was that the POST was not sending the appropriate content-type header. POSTs to the Convio API must set:



    content-type=application/x-www-form-urlencoded

Categories