Delete a Custom Field

Hi,

I've been upgrading a custom wrapper we use from v2 to v3 and have hit a problem with Deleting a Custom Field from an existing Subscriber list.

I've managed to create a new custom field using the info outlined here http://www.campaignmonitor.com/api/lists/#creating_a_custom_field.
I now need to delete it (for testing purposes) but for some reason the api is always returning 404.

The process I'm using is:

1/ Get a list of custom fields using http://api.createsend.com/api/v3/lists/{listid}/customfields.xml and find the relevant Key.
2/ Call http://api.createsend.com/api/v3/lists/{listid}/customfields/{key}.xml to delete it.

Point 2 is returning Code 404, "We couldn't find the resource you're looking for. Please check the documentation and try again".

I've tried Debugging the whole process.  The URL is correct according to the docs.  I also tried the .json extension but that doesn't seen to make a difference.

I can post the listid and key if required.

Thanks.

Phil Phil, 5 years ago

Hi leem,

Two possibilities come to mind immediately:

1. You need to be able to specify the http verb with your route. When attempting to delete your custom field, are you using a DELETE http verb with your call to the route, as mentioned in the docs? (in all cases the little brown word "DELETE" next to the route is there to define what type of request is needed)
2. Are you certain you're using the correct key? It should include the square brackets in the string - eg "[key]"

Beyond that there could of course be many other reasons it fails. I understand that you've got a custom wrapper that you've worked with historically, but v2 and v3 of the API are different enough that simply porting it across won't be trivial. You might find it easier to use an appropriate wrapper instead.

If you're still having troubles, drop us a line on support at campaignmonitor dot com with a bit of your code (censor the api key, etc) and we'll take a peek for you.

Phil

leem, 5 years ago

Hi Rob,

Managed to fix it.  The problem was with the c# WebClient class.  After a bit of investigation the problem seemed to be with url encoding with the [ and ] characters.  Your point of checking that they were included pointed me in the right direction.

Our wrapper contains specific could for our own system as well as CM which is why we had to stick with it and upgrade from v2 to v3.

Thanks,
Lee

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098