I'm having trouble using the API to view a segment. I'm using PHP. My code is as follows:
$url = "https://us7.api.mailchimp.com/export/1.0/list/?apikey=$api_key&id=$list_id&$segment";
$result = file_get_contents($url);
where $segment is an array used to generate the segment.
I can get the following version working...
$segment = "segment[match]=all"
"&segment[conditions][0][field]=LNAME".
"&segment[conditions][0][op]=like".
"&segment[conditions][0][value]=smith";
which generates a segment of all subscribers to my list with a last name containing "smith".
However, what I actually want to do is generate a segment based on people who've been sent any mailer in the last 7 days. I've created this manually to get the correct fields and generated the following array based on it:
$segment = "segment[match]=all".
"&segment[conditions][0][condition_type]=Aim".
"&segment[conditions][0][field]=aim".
"&segment[conditions][0][op]=sent".
"&segment[conditions][0][value]=last7day";
but it's giving me a 300 error. This isn't listed in MailChimp's current error glossary on the export api documentation, but according to a snapshot of the old error documentation means "Campaign doesn't exist" (https://web.archive.org/web/20130209144951/https://apidocs.mailchimp.com/api/1.3/exceptions.field.php) which is weird because I'm not referencing a campaign.
What am I doing wrong?
// , Click on playground and with your API key.
Generate some responses and look at the campaign id.
It's not the integer value you see when hovering over the campaign with id=, it's another value.
Look for the id that the API needs in the response.
This will fix your issue.
I'm looking to get the user_location on login but it doesn't seem to work. I presumed the parameter in the graph was "locations" but it claims it's been deprecated as of 2.2. Are you not able to get user location anymore or is it because it's an array I need to do something extra? I can't seem to find the answer in the documentation. Thanks in advance.
My code:
$profile_request = $fb->get('/me?fields=first_name,last_name,email,gender');
$requestLikes = $fb->get('/me/likes?limit=20');
$requestlocation = $fb->get('/me/locations');
$profile = $profile_request->getGraphNode()->asArray();
$likes = $requestLikes->getGraphEdge();
$location = $requestlocation->getGraphNode()->asArray();
My error:
Graph returned an error: (#12) locations API is deprecated for versions v2.0 and higher
OK so I solved it. I don't know why but when I took "location" in with the array profile[] I was able to retrieve it. Not exactly sure why this works yet.
I am using google shopping Api from last one year it is working properly. But now I want to add new attributes in it such as CustomLabel5. For that I have used setCustomAttributes() method and passed three attributes name, type ,value.
But it is working showing error 400 invalid attribute values. following is my code please check and suggest proper answer for that.
$product = new Google_Service_ShoppingContent_Product();
$data= new Google_Service_ShoppingContent_ProductCustomAttribute();
$data->setName('CustomLabel5');
$data->setType('text');
$data->setValue('test');
$product->setCustomAttributes($data);
Please give answer.
Fairly simple fix here.
setCustomAttributes expects an array of Google_Service_ShoppingContent_ProductCustomAttribute instances.
What you need is:
$attributesArray = array($data);
$product->setCustomAttributes($attributesArray);
I try to make an script to get data from LINKEDIN, i am able to get many of information about profile like name, mail, phone, picture url and so on, unfortunately how ever I try I can't get to informations like work experience and many other.
My Request looks like:
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,interests,publications,patents,languages,skills,date-of-birth,email-address,phone-numbers,im-accounts,main-address,twitter-accounts,headline,picture-url,public-profile-url)");
This work correctly, but lets try to add companies
Error:
I added it at the end of $linkedin->getProfile and here is the
error message what I get:
[message] => Unknown field {companies} in resource {Person}
Full function looks like:
public function linkedinGetUserInfo( $requestToken='', $oauthVerifier='', $accessToken=''){
include_once 'linkedinoAuth.php';
$linkedin = new LinkedIn($this->config['linkedin_access'], $this->config['linkedin_secret']);
$linkedin->request_token = unserialize($requestToken); //as data is passed here serialized form
$linkedin->oauth_verifier = $oauthVerifier;
$linkedin->access_token = unserialize($accessToken);
try{
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,interests,publications,patents,languages,skills,date-of-birth,email-address,phone-numbers,im-accounts,main-address,twitter-accounts,headline,picture-url,public-profile-url,educations,companies)");
}
catch (Exception $o){
print_r($o);
}
return $xml_response;
}
Documentation I found (but didn't help me )
https://developer.linkedin.com/docs/fields
I expect I miss something really stupid but cant figurate it out, can somone help me?
LinkedIn provided all these fields before May 12th 2015.
https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address,picture-url,industry,associations,interests,num-recommenders,date-of-birth,honors-awards,three-current-positions,three-past-positions,volunteer,location," +
"positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker))," +
"educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes)," +
"publications:(id,title,publisher:(name),authors:(id,name),date,url,summary),"+
"languages:(id,language:(name),proficiency:(level,name)),"+
"skills:(id,skill:(name)))";
"courses:(id,name,number),"+
"recommendations-received:(id,recommendation-type,recommendation-text,recommender))";
"patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name),date,url))";
But, they have updated their APIs link:https://developer.linkedin.com/support/developer-program-transition
According to which only these
Profile API — /v1/people/~
Share API — /v1/people/~/shares
Companies API — /v1/companies/{id}
endpoints will be active, Rest require a Apply with Linkedin /Partner with Linked association.
phone-numbers,im-accounts,main-address,twitter-accounts,headline would come under r_contactinfo which needs a Apply with linkedin
Instead of companies, you must use positions keyword.
$xml_response = $linkedin->getProfile("~:(id,first-name,last-name,positions)");
Positions field description in the following address.
https://developer.linkedin.com/docs/fields/positions
I try to sort records returned by the get_entry_list rest api method, and it doesn't working.
Request JSON:
{
"session":"mj95dgk1ldtd2m96u02oj0u3r2",
"module_name":"Accounts",
"query":"accounts.name LIKE 'Air%'",
"order_by":"accounts.name desc",
"offset":0,
"select_fields":[
],
"link_name_to_fields_array":"",
"max_result":100,
"deleted":0,
"favorites":false
}
I'm using api version 4.1.
Results are not sorted even using ASC or DESC sorting method.
Manage to solve the problem based on this link
https://web.sugarcrm.com/support/issues/806c9fb3-6712-abd6-3106-5287d5398699
Proposed fix:
in service/v4/SugarWebServiceUtilv4.php
Around line 89: remove or comment the following line:
$order_by=$seed->process_order_by($order_by, null);
It certainly would be better to fix that in SugarBean.php (process_order_by) where the following test was removed:
if (strchr($value,'.') === false)
it seems like this is bug in sugar crm ( Bug :59526 ) .
order by not working with web service
But you can also fetch the record by creating your own method for Api , i hope this helps !