Google Contacts API "Invalid request." 400 error on name change - google-api

Updating a contact via the Google Contacts API fails when trying to edit a contacts name only without any other changes (besides updated time).
Important note: When the name change is sent along with an email or phone number change it succeeds... only when the name change is sent alone does an error occur. For example changing the contact name and changing 1 character in the email address (or phone number) makes the request successful.
Response from Google Server (http_code 400): "Invalid request."
<entry
xmlns="http://www.w3.org/2005/Atom"
xmlns:gd="http://schemas.google.com/g/2005" gd:etag="*">
<id>http://www.google.com/m8/feeds/contacts/example%40gmail.com/base/realcontactidhere</id>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/>
<title>SameFirst DifferentLast</title>
<updated>2019-04-22T18:55:59+00:00</updated>
<gd:name>
<gd:givenName>SameFirst</gd:givenName>
<gd:familyName>DifferentLast</gd:familyName>
<gd:fullName>SameFirst DifferentLast</gd:fullName>
</gd:name>
<gd:phoneNumber rel="http://schemas.google.com/g/2005#mobile">+1 555 555 5555</gd:phoneNumber>
<gd:email rel="http://schemas.google.com/g/2005#work" displayName="SameFirst DifferentLast" address="SameFirstDifferentLast#example.com" />
<link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*" href="https://www.google.com/m8/feeds/photos/media/example%40gmail.com/realcontactidhere?v=3.0"/>
<link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/example%40gmail.com/full/realcontactidhere?v=3.0"/>
<link rel="edit" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/example%40gmail.com/full/realcontactidhere?v=3.0"/>
Strangest thing I have seen... not sure where to go from here. Any suggestions?

Solution that only took all day to figure out:
When changing a contact name only, and nothing else, the displayName property needs to be removed from the XML you are sending to Google.
This will succeed:
<gd:email rel="http://schemas.google.com/g/2005#work" address="SameFirstDifferentLast#example.com" />
This will fail:
<gd:email rel="http://schemas.google.com/g/2005#work" displayName="SameFirst DifferentLast" address="SameFirstDifferentLast#example.com" />

Related

NoMeasureSelected CampaignPerformanceReportRequest Microsoft Ads

I'm trying to setup Microsoft ads to a project and get CampaignPerformanceReportRequest working on my project but I'm receiving NoMeasureSelected error. Not sure where the issue is.
I added all the columns mention in the documentation to see if the work, but still getting same error. I tested using add dashboard report. It only require Impression and TimePeriod to generate successful report. I make my request to match the request in dashboard, but still get the same error.
Project is based on Ruby on rails.
<env:Body>
<v13:SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
<v13:ReportRequest xsi:type="CampaignPerformanceReportRequest">
<v13:ExcludeColumnHeaders>true</v13:ExcludeColumnHeaders>
<v13:ExcludeReportFooter>true</v13:ExcludeReportFooter>
<v13:ExcludeReportHeader>true</v13:ExcludeReportHeader>
<v13:Format>Csv</v13:Format>
<v13:ReportName>Test Report</v13:ReportName>
<v13:ReturnOnlyCompleteData>false</v13:ReturnOnlyCompleteData>
<v13:Aggregation>Summary</v13:Aggregation>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>AccountId</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>CampaignId</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>Keyword</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>KeywordId</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>DeviceType</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>Clicks</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Filter xsi:nil="true"/>
<v13:Scope>
<v13:AccountIds xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:long>[REDACTED]</a1:long>
</v13:AccountIds>
</v13:Scope>
<v13:Time>
<v13:CustomDateRangeEnd>
<v13:Day>30</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeEnd>
<v13:CustomDateRangeStart>
<v13:Day>01</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeStart>
</v13:Time>
</v13:ReportRequest>
</v13:SubmitGenerateReportRequest>
</env:Body>
Response:
<s:Body>
<s:Fault>
<faultcode>s:Server</faultcode>
<faultstring>Invalid client data. Check the SOAP fault details for more information. TrackingId: 96ad1b6d-26e2-4b60-91d0-b6a68add6140.</faultstring>
<detail>
<ApiFaultDetail xmlns="https://bingads.microsoft.com/Reporting/v13" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<TrackingId xmlns="https://adapi.microsoft.com">96ad1b6d-26e2-4b60-91d0-b6a68add6140</TrackingId>
<BatchErrors/>
<OperationErrors>
<OperationError>
<Code>2017</Code>
<Details i:nil="true"/>
<ErrorCode>NoMeasureSelected</ErrorCode>
<Message>The specified report request does not specify measurement columns (at least one is required). Please submit a report request with the required columns for this report type, and optionally additional columns that are to be included in the report.</Message>
</OperationError>
</OperationErrors>
</ApiFaultDetail>
</detail>
</s:Fault>
</s:Body>
Does any one know what is the issue here or any one has working SOAP request ?
Looks like your structure around Columns isn't quite right.
I think what the error The specified report request does not specify measurement columns (at least one is required). Please submit a report request with the required columns for this report type, and optionally additional columns that are to be included in the report. refers to is that Columns should have multiple values (i.e. be an 'array') - not itself be repeated like in your example.
I infer this from the reference documentation where Columns is defined with type ArrayOfCampaignPerformanceReportColumn.
<xs:element name="Columns" nillable="true" type="tns:ArrayOfCampaignPerformanceReportColumn" />
For your example, something like this should work:
<env:Body>
<v13:SubmitGenerateReportRequest xmlns="https://bingads.microsoft.com/Reporting/v13">
<v13:ReportRequest xsi:type="CampaignPerformanceReportRequest">
<v13:ExcludeColumnHeaders>true</v13:ExcludeColumnHeaders>
<v13:ExcludeReportFooter>true</v13:ExcludeReportFooter>
<v13:ExcludeReportHeader>true</v13:ExcludeReportHeader>
<v13:Format>Csv</v13:Format>
<v13:ReportName>Test Report</v13:ReportName>
<v13:ReturnOnlyCompleteData>false</v13:ReturnOnlyCompleteData>
<v13:Aggregation>Summary</v13:Aggregation>
<v13:Columns>
<v13:CampaignPerformanceReportColumn>AccountId</v13:CampaignPerformanceReportColumn>
<v13:CampaignPerformanceReportColumn>CampaignId</v13:CampaignPerformanceReportColumn>
<v13:CampaignPerformanceReportColumn>Keyword</v13:CampaignPerformanceReportColumn
<v13:CampaignPerformanceReportColumn>KeywordId</v13:CampaignPerformanceReportColumn>
<v13:CampaignPerformanceReportColumn>DeviceType</v13:CampaignPerformanceReportColumn
<v13:CampaignPerformanceReportColumn>Clicks</v13:CampaignPerformanceReportColumn>
</v13:Columns>
<v13:Filter xsi:nil="true"/>
<v13:Scope>
<v13:AccountIds xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:long>[REDACTED]</a1:long>
</v13:AccountIds>
</v13:Scope>
<v13:Time>
<v13:CustomDateRangeEnd>
<v13:Day>30</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeEnd>
<v13:CustomDateRangeStart>
<v13:Day>01</v13:Day>
<v13:Month>04</v13:Month>
<v13:Year>2022</v13:Year>
</v13:CustomDateRangeStart>
</v13:Time>
</v13:ReportRequest>
</v13:SubmitGenerateReportRequest>
</env:Body>

ColdFusion Proxy Server

I'm trying to create a basic proxy server so I can keep track of what my kids are doing web wise - I know there are products out there but I thought it would be an interesting exercise to write one myself.
I have the following code that kind of works but doesn't pull any images or css through - I guess because it makes another call to the remote server and gets confused
<cfhttp url="https://www.bbc.co.uk">
<cfhttpparam type="header" name="Proxy-Connection" value="keep-alive" >
<cfhttpparam type="header" name="Accept" value="application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5">
<cfhttpparam type="header" name="Accept-Language" value="en-US,en;q=0.8">
<cfhttpparam type="header" name="Accept-Charset" value="ISO-8859-1,utf-8;q=0.7,*;q=0.3">
</cfhttp>
<cfset html = cfhttp.FileContent />
<cfoutput>#html#</cfoutput>`
What am I missing?
What you want to use is the resolveurl parameter of - set it to yes/true. This defaults to no.
What this parameter does is resolves relative paths to absolute paths automatically for you.
Now, if you want to change those paths as well, you would change them to also route through your http proxy script, but there won't be much use as you won't know much about the content regardless.
resolveurl should hook you up with what you are looking for. cheers.
https://cfdocs.org/cfhttp (look for resolveurl tag attribute)

WebSphere Commerce IDResGen query

I'm trying to load em spots using massload. I'm finding the internal alias method of idresgen.bat is only resolving the internal alias for foreign key references, but I need to use the value in dmelementnvp value column which doesn't have a foreign key reference.
In the sample code below the last dmelementnvp definition is rejected with an error that value could not be resolved. Does anyone know how to resolve the emspot id to populate the value column required?
<emspot
emspot_id="#emspot_id_1"
storeent_id="&MAR_STOREENT_ID;"
name="Home_BestSellers"
description="Display catalog entry recommendations from Coremetrics Intelligent Offer on the home page."
usagetype="MARKETING"
supportedtypes="P"
/>
<dmactivity
dmactivity_id="#dmactivity_bestseller1"
storeent_id="&MAR_STOREENT_ID;"
name="HomePageBestSellersActivity"
description="The test activity for the home page best sellers"
published="1"
state="1"
behavior="1"
dmcampaign_id="#campaign_initial_launch"
/>
<dmelement
dmelement_id="#dmactivity_bestseller_elem1"
name="Flow0.0"
dmeletemplate_id="6"
dmactivity_id="#dmactivity_bestseller1"
sequence="0"
/>
<dmelement
dmelement_id="#dmactivity_bestseller_elem2"
name="Coremetrics Target"
dmeletemplate_id="339"
dmactivity_id="#dmactivity_bestseller1"
sequence="1500"
parent="Flow0.0"
/>
<dmelement
dmelement_id="#dmactivity_bestseller_elem3"
name="Espot Target"
dmeletemplate_id="105"
dmactivity_id="#dmactivity_bestseller1"
sequence="1000"
parent="Flow0.0"
/>
<dmelementnvp
dmelement_id="#dmactivity_bestseller_elem2"
name="zoneIdList"
value="ZoneA"
/>
<dmelementnvp
dmelement_id="#dmactivity_bestseller_elem3"
name="emsId"
value="#emspot_id_1"
/>
I would ask this question to IBM Software Support.

Scriptella: How to handle the error while fetching data from XML through Xpath

i have one query regarding data fetching from XML xpath.
<query connection-id="in">
CommunicationCenter/Response/MenuData/Menu/Noun
<!--something I have to do inside script using the data fetched from xpath-->
</query>
My question is - suppose 1 of the XML doesn't have this structure of Xpath. It has "OtherCommCenter/MenuData/Menu/Noun" or something else structure. Then, when I run the job, it says the job is executed with no exception & as it does not get any value from xpath, nothing is happened. Means it gives back null. So, how do I catch the error there? I have to know which element in xpath creates the problem or if that is not possible, at least which xml is creating this error in structure ?
(because in my project, there are multiple XMLs I have to handle & I am doing that by submitting jobs to ExecutorService like you described in How to ETL multiple files using Scriptella?)
P.S. for the last part, I am doing like this
<connection id="in" driver="xpath" url="$input"/>
where "input" is the map key for the different xml file name.
can anybody help me? it is necessary to know asap for my project.
Here is an artificial example. Let's say there are kind of XMLs - people and cars.
people.xml:
<people>
<person></person>
</people>
Cars.xml:
<cars>
<car/>
</car>
The following xml runs 2 queries for /people/person and /cars/car and set global flags if at least one record was found:
<etl>
<connection driver="jexl" id="jexl"/>
<connection driver="xpath" id="xpath" url="input.xml"/>
<connection id="log" driver="text"/>
<query connection-id="xpath">
/people/person
<script connection-id="jexl">
# set flag to true if at least one element was found
etl.globals['people']=true;
</script>
</query>
<script connection-id="log" if="!etl.globals['people']">
WARNING: No people found in the XML file
</script>
<query connection-id="xpath">
/cars/car
<script connection-id="jexl">
etl.globals['cars']=true;
</script>
</query>
<script connection-id="log" if="!etl.globals['cars']">
WARNING: No cars found in the XML file
</script>
</etl>

Address Parser for Ruby

Is anyone aware of an address parser plugin for Ruby?
I might have to use one of the paid webservices but thought there might be a plugin.
Another thought is go down the NLP route where I could build up a database over time.
Does anybody use any NLP plugin for ruby?
I want to use it to logically parse and sanitise something like this from the HTML:
<address><strong>HALL (J&E) LTD</strong><br />Head Office<br />
Questor House<br />
191 Hawley Road<br />
Dartford<br />
Kent <br />
DA1 1PU</address>
<p class="tel"><strong>Tel:</strong> +44 (0)1322 223456</p>
<p class="fax"><strong>Fax:</strong> +44 (0)1322 291458</p>
<p><strong>Website:</strong> <a target="_blank" href="http://www.jehall.co.uk">www.jehall.co.uk</a></p>
<p><strong>Email:</strong> helpline#jehall.co.uk</p>
</div>
Any suggestions gladly appreciated.
You might have some success with Googles geocoding service. This can return structured addresses. There are ruby gems for interfacing with Googles maps API

Resources