cancel
Showing results for 
Search instead for 
Did you mean: 

c# Getting Started

All Star

c# Getting Started

I pulled down the samples from GitHub for C# and visual studio.  I went through the steps of getting a mashery account, access token, api key and shared secret.  I used the test page and had no issues.  In app.config it's asking for 

 

<add key="APIKey" value=""/>
<add key="Password" value=""/>
<add key="Username" value=""/>
<add key="RedirectURL" value=""/>

 

The APIKey is straightforward.  However, I am not clear on what password, username and redirect url to use?  I've tried various combinations to no avail.  I end up getting this error when I run the programs

 

CtCTException Thrown:

Error Message: http.status.unauthorized:No authentication is present 

 

 

13 REPLIES 13
Honored Contributor

Re: c# Getting Started

Hi Todd,

 

I was able to reply to your email about this, but I also wanted to share here for anyone else who may have questions.

 

Based on what you've provided it looks like you're using a notably older version of the SDK that likely will not function any longer. How did you obtain the version of the .NET code that you're currently working with?

For reference, the most up-to-date code can be found here: https://github.com/constantcontact/.net-sdk


As an additional note, the examples in the SDK use OAuth to connect with the API and obtain an Access Token, but if you are building an integration for a single Constant Contact account, you can simply store your Access Token in your application configuration and use it directly, rather than using the OAuth methods to get the access token.

Please let me know if you have any questions!

 

Sincerely,

Elijah G.
API Support Engineer
Highlighted
All Star

Re: c# Getting Started

Thanks can you give the example of where I put my credentials for my single account so I don't get the user name /password when i run these samples?

 

The original code I obtained I found here https://developer.constantcontact.com/libraries/sample-code.html

Honored Contributor

Re: c# Getting Started

Hello,

 

With the most up-to-date versions of these samples, they should not ask for or require the username/password. Instead they make use of the OAuth client flow to get an Access Token. If you're looking to store the credentials for a single account in your application config, you can generate Access Tokens using our API tester here: https://constantcontact.mashery.com/io-docs. Once you have a token for the desired account, you can store that token and your API Key.

 

Please note that this process is only appropriate when connecting a single account. For any integrations that need to be able to serve many accounts, OAuth should always be used so that the users are not required to go through steps designed for developers.

 

Please let me know if you have any follow-up questions!

 

Sincerely,

Elijah G.
API Support Engineer
Occasional Participant

Re: c# Getting Started

I've downloaded the GitHub project and successfully built and obtained the CTCT.DLL.

 

However I'm completely missing the ConstantContact Class and all its methods. All the others are there. I see in the development branch is there. Did this get pulled out for something else? If so the documentation and samples and everything is old / wrong now. 

 

Therefore I cannot really use it at all! 

 

Error 8 Type 'CTCT.ConstantContact' is not defined.

 

I can use the DLL to build all the objects like below, but the main method to connect to the endpoints is not there!. 

 

 

 

Dim contact As New Contact()
' Don't care about the id value
contact.Id = 1
contact.Status = Status.Active
contact.FirstName = row("FirstName")
contact.LastName = row("LastName")
contact.Addresses.Add(New Contacts.Address With {.Line1 = row("Address").ToString,
.City = row("City").ToString, .StateName = row("st").ToString, .PostalCode = row("ZipCode").ToString, .AddressType = "PERSONAL"})


Dim addy As New EmailAddress()

addy.EmailAddr = row("email").ToString
addy.ConfirmStatus = ConfirmStatus.NoConfirmationRequired
addy.Status = Status.Active
addy.Id = 1

 

 


6-7-2016 4-26-11 PM.jpg
Occasional Participant

Re: c# Getting Started

BUMP

Honored Contributor

Re: c# Getting Started

Hello,

 

My apologies for not getting you an answer on this sooner! After a bit of checking, it looks like the current docs hosted on github.io are for a notably outdated version of the .NET SDK and are not currently a valid guide. I will be looking to see what can be done to get this resolved, but it may be a bit before the new docs will be available. In the immediate term I would advise looking at the samples provided in the SDK for guidance.

 

If you run into any problems while building or have any questions about the SDK, you can also post a topic here on the forums and I'll be happy to help!

 

Sincerely,

Elijah G.
API Support Engineer
Occasional Participant

Re: c# Getting Started

Thanks for confirming this and I'll go ahead and use the samples for reference, just wanted to make sure that I wasn't missing something obvious!

 

 

New Member

Re: c# Getting Started

Any progress on new DOC's  Git is still show Old samples

Moderator

Re: c# Getting Started

Hello,

 

Because our team is devoting most of our resources to building out the new V3 version of our API, this documentation is not likely to be updated or worked on in the short term. Having said that, we do still have current examples in the Readme on github, including how to generate or create a service object using the ConstantContactFactory.

 

Please let me know if you have any other questions!

 

Sincerely,
David B.
API Support Specialist