BigCommerce - Hosted Ecommerce Software by Interspire

Interspire Forum

 
Go Back   Interspire Forum > Interspire Email Marketer Community Forum > Customization and Integration

Reply
 
Thread Tools Display Modes
  #1  
Old 02-22-2010, 08:21 AM
ghalaszi + ghalaszi is offline
Interspire Customer
 
Join Date: Mar 2008
Posts: 10
Default XML API: unable to call the "GetSubscribers" function with CustomFields searchinfo

--------------------------------
Supporting Information
--------------------------------
Product Version: 6.0.2
Operating System: Any Linux or Unix OS

--------------------------------
Problem Summary
--------------------------------
I couldn not use the GetSubscribers function (subscribers.php) with CustomFields searchinfo using the XML API.

--------------------------------
Problem Description
--------------------------------
We use the Interspire Email Marketer XML API from .NET code. We can send several xml requests to the server and we can handle the responses. We can use the following fuctions fine:
subscribers->IsSubscriberOnList/AddSubscriberToList/SaveSubscriberCustomField/GetAllSubscriberCustomFields/AddEvent/GetSubscribers/ChangeSubscriberConfirm.
We can build the xml documents for these requests.

I have problem with the GetSubscribers functions.
I can get the confirmed users from the list (id:2) fine without the CustomFields searchinfo:
Quote:
HTML Code:
<xmlrequest>
  <username>admin</username> 
  <usertoken>xxxxxx</usertoken> 
  <requesttype>subscribers</requesttype> 
  <requestmethod>GetSubscribers</requestmethod> 
  <details>
    <searchinfo>
	  <List>2</List> 
      <Confirmed>1</Confirmed> 
    </searchinfo>
  </details>
</xmlrequest>
Next I want to add additional searchinfo for custom fields. Could you provide us a sample xml for a query which uses custom field?
This custom field is required:
custom field id: 13, this is a simple text field. It should be for example "Nagy".


I tried the following xml files:
1)
Quote:
HTML Code:
<xmlrequest>
	<username>admin</username> 
	<usertoken>xxxx</usertoken> 
	<requesttype>subscribers</requesttype> 
	<requestmethod>GetSubscribers</requestmethod> 
	<details>
		<searchinfo>
			<List>2</List> 
			<CustomFields>
			<item>
				<fieldid>13</fieldid> 
				<fielddata>Nagy</fielddata> 
			</item>
			</CustomFields>
		</searchinfo>
	</details>
</xmlrequest>
2)
Quote:
HTML Code:
<xmlrequest>
	<username>admin</username> 
	<usertoken>xxxx</usertoken> 
	<requesttype>subscribers</requesttype> 
	<requestmethod>GetSubscribers</requestmethod> 
	<details>
		<searchinfo>
		<List>2</List> 
		<CustomFields>
		<item>
			<fieldid>13</fieldid> 
			<value>Nagy</value> 
		</item>
		</CustomFields>
		</searchinfo>
	</details>
</xmlrequest>
The answer was the following in both cases:
Quote:
HTML Code:
<data>
	<count>0</count> 
	<subscriberlist /> 
</data>
I didn not get any error message in the email_log_system_system table.
When I search with the same criterias on the GUI then 4 contacts returns (custom field with "13" ID and "Nagy" value).


Could you send us a valid xml for this request?
- list:2
- confirmed: 1
- CustomFields
fieldid:13, value: "Nagy"

Thanks.

Last edited by ghalaszi; 02-22-2010 at 08:45 AM.. Reason: fixing the xml parts of the post
Reply With Quote
  #2  
Old 03-16-2010, 01:41 PM
edv + edv is offline
Interspire Customer
 
Join Date: Jun 2004
Posts: 4
Default Where/how can the xmlrequest tag be used?

I understand the php examples in other threads but where/how can the xmlrequest tag be used that you are discussing in this thread? Can someone provide a full example of a file where the example xmlrequest tag is implemented? Thanks!
Reply With Quote
  #3  
Old 06-10-2010, 07:58 PM
royle78
Guest
 
Posts: n/a
Default We have this question too!

We have this exact same question and any help or a push in the right direction would be appreciated.
Reply With Quote
  #4  
Old 11-17-2010, 10:37 AM
odnico + odnico is offline
Interspire Customer
 
Join Date: Nov 2010
Posts: 2
Default

Quote:
Originally Posted by ghalaszi View Post
--------------------------------


We use the Interspire Email Marketer XML API from .NET code. We can send several xml requests to the server and we can handle the responses. We can use the following fuctions fine:
subscribers->IsSubscriberOnList/AddSubscriberToList/SaveSubscriberCustomField/GetAllSubscriberCustomFields/AddEvent/GetSubscribers/ChangeSubscriberConfirm.
We can build the xml documents for these requests.
Please, can you post an example of how to use the GetAllSubscriberCustomFields function?

I tried with the following xml snippet, but I didn't get any result.
HTML Code:
<requesttype>subscribers</requesttype>
<requestmethod>GetAllSubscriberCustomFields</requestmethod>
<details>
<listids>46</listids>
<subscriberid>216915</subscriberid>
<custom_fieldids>90</custom_fieldids>
</details>
Thanks.

Last edited by odnico; 11-17-2010 at 03:39 PM..
Reply With Quote
  #5  
Old 08-20-2012, 10:09 PM
zoeski + zoeski is offline
Interspire Customer
 
Join Date: Aug 2012
Posts: 2
Default How to filter on CustomFields in getSubscribers in XML API

Hi

I have the same problem as ghalaszi. I have tried the example code below and am getting the same results.

Can anyone provide some more info on how to filter on CustomFields in the getSubscribers call from XML API?

Thanks


Quote:
Originally Posted by ghalaszi View Post
--------------------------------
Supporting Information
--------------------------------
Product Version: 6.0.2
Operating System: Any Linux or Unix OS

--------------------------------
Problem Summary
--------------------------------
I couldn not use the GetSubscribers function (subscribers.php) with CustomFields searchinfo using the XML API.

--------------------------------
Problem Description
--------------------------------
We use the Interspire Email Marketer XML API from .NET code. We can send several xml requests to the server and we can handle the responses. We can use the following fuctions fine:
subscribers->IsSubscriberOnList/AddSubscriberToList/SaveSubscriberCustomField/GetAllSubscriberCustomFields/AddEvent/GetSubscribers/ChangeSubscriberConfirm.
We can build the xml documents for these requests.

I have problem with the GetSubscribers functions.
I can get the confirmed users from the list (id:2) fine without the CustomFields searchinfo:


Next I want to add additional searchinfo for custom fields. Could you provide us a sample xml for a query which uses custom field?
This custom field is required:
custom field id: 13, this is a simple text field. It should be for example "Nagy".


I tried the following xml files:
1)


2)


The answer was the following in both cases:

I didn not get any error message in the email_log_system_system table.
When I search with the same criterias on the GUI then 4 contacts returns (custom field with "13" ID and "Nagy" value).


Could you send us a valid xml for this request?
- list:2
- confirmed: 1
- CustomFields
fieldid:13, value: "Nagy"

Thanks.
Reply With Quote
  #6  
Old 08-27-2012, 06:49 PM
robertgrinde + robertgrinde is offline
Interspire Customer
 
Join Date: Mar 2011
Posts: 3
Default

I have the exact same problem, any help would be much appreciated.
Reply With Quote
  #7  
Old 08-27-2012, 08:44 PM
robertgrinde + robertgrinde is offline
Interspire Customer
 
Join Date: Mar 2011
Posts: 3
Lightbulb A solution!

Al-right, I figured it out!

After painstakingly working myself through the thousand lines of code with a lot of trial and error I finally found the solution, the correct syntax to use is the following:

HTML Code:
<username>YourUsername</username>
<usertoken>...</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>GetSubscribers</requestmethod>
  <details>
    <searchinfo>
    <List>1</List>
    <CustomFields>
      <13>nagy</13>
    </CustomFields>
    </searchinfo>
  </details>
</xmlrequest>

There is only one problem with this, XML does not allow field names to be only numbers, but IEM requires numbers for field ID's

So, how can we work around that?

First, open up admin/functions/api/subscribers.php

Find the function _CreateCustomFieldSubquery


Find the following code

PHP Code:
            foreach ($searchinfo['CustomFields'] as $fieldid => $fielddata) {
                if (
$fielddata != "") {

                    
$fieldtype $this->GetCustomFieldType($fieldid); 
Replace it with:

PHP Code:
            foreach ($searchinfo['CustomFields'] as $fieldid => $fielddata) {
                if (
$fielddata != "") {
          
$fieldid  str_replace("myfield"""$fieldid );

                    
$fieldtype $this->GetCustomFieldType($fieldid); 

And then use the following XML

HTML Code:
<username>YourUsername</username>
<usertoken>...</usertoken>
<requesttype>subscribers</requesttype>
<requestmethod>GetSubscribers</requestmethod>
  <details>
    <searchinfo>
    <List>1</List>
    <CustomFields>
      <myfield13>nagy</myfield13>
    </CustomFields>
    </searchinfo>
  </details>
</xmlrequest>

Works like a charm :-)
Although Interspire should look into an official solution as this is clearly a bug...

Last edited by robertgrinde; 08-27-2012 at 08:47 PM..
Reply With Quote
  #8  
Old 08-29-2012, 12:30 AM
zoeski + zoeski is offline
Interspire Customer
 
Join Date: Aug 2012
Posts: 2
Default

That's freaky Robert, that is pretty much exactly what I did.
Zoe
Reply With Quote
  #9  
Old 08-29-2012, 07:37 AM
robertgrinde + robertgrinde is offline
Interspire Customer
 
Join Date: Mar 2011
Posts: 3
Default

Quote:
Originally Posted by zoeski View Post
That's freaky Robert, that is pretty much exactly what I did.
Zoe
Great minds think alike?
Next time feel free to share the solution and save fellow developers s great deal of bugsearching and keyboadslamming
Reply With Quote
  #10  
Old 11-07-2013, 09:14 AM
imuser + imuser is offline
Interspire Customer
 
Join Date: Oct 2013
Posts: 4
Default

Could you please post the example of GetAllSubscriberCustomFields request or the other one, that gets custom field values of given subscriber? As far as I know the GetSubscribers request provides only simple fields..
Thanks
Reply With Quote
Reply

Tags
api, custom fields, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump