We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Set the state/province for non-US

ShaneM178
Frequent Participant

Set the state/province for non-US

Hi,

Could somebody tell me how I can set the state name when the contact has an address outside the US?

state_code is mentioned here.

Is this what sub_postal_code is for?

Thanks

10 REPLIES 10
DaveBerard
Moderator

At this point, we don't support international states for the Contact object.  I will look into what it would take to support that and give an update once we have more information.

Dave Berard
Senior Product Manager, Constant Contact

Could we possibly set state_name directly?

We opened a defect on our side to add the state_name field to the API.  We will take a look at getting that out as soon as we can and updating the documentation to reflect this.  As of now, we don't support that field so it's not possible to send it in.  Will update once we have a timeline on adding that.

Dave Berard
Senior Product Manager, Constant Contact
DurableD
Occasional Participant

Any progress on this?

 

This field was added to the API in our Dec. release. You can see the details in our release notes here: http://techblog.constantcontact.com/api/release-updates/api-release-notes-december-2013/

 

Also, this is documented on our Contact documentation here: http://developer.constantcontact.com/docs/contacts-api/contacts-resource.html

Dave Berard
Senior Product Manager, Constant Contact
ShaneM178
Frequent Participant

This doesn't appear to be reflected in your SDK (for C#) - is there a timeline for when this will be added?

We'll add it to our list of things to add to the SDK, no timeline available today for when that will be.  We do try to update them regularly, hopefully you'd see something in the next 2-6 weeks.  Alternatively, you can add this to the SDK directly and feel free to submit a pull request to contribute those changes to the community as a whole.

Dave Berard
Senior Product Manager, Constant Contact
ShaneM178
Frequent Participant

I don't know how to do that I'm afraid.

 

To add support for this field, simply add the following few lines to the Address class (Address.cs) - I called the property StateName:

 

/// <summary>
/// Gets or sets the state name.
/// </summary>
[DataMember(Name = "state", EmitDefaultValue = false)]
public string StateName { get; set; }

 

I've tested this and it appears to work well.

 

Thanks,

 

Shane

ShaneM178
Frequent Participant

I've now submitted a pull request - hope I've done it right!

Looks great, thanks for the submission!  Merged the pull request just now.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page