Can't get data of a problematic section with Wikipedia API - wikipedia-api

I'd like to get the contents of the "Goalscorers" section from the Wikipedia page http://en.wikipedia.org/wiki/2014_FIFA_World_Cup#Goalscorers.
I used the command
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=2014_FIFA_World_Cup&rvprop=content&rvsection=32
but I get an empty section:
<?xml version="1.0"?>
<api>
<query>
<normalized>
<n from="2014_FIFA_World_Cup" to="2014 FIFA World Cup" />
</normalized>
<pages>
<page pageid="656933" ns="0" title="2014 FIFA World Cup">
<revisions>
<rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">===Goalscorers===
{{2014 FIFA World Cup Goalscorers}}</rev>
</revisions>
</page>
</pages>
</query>
</api>
How can I get the actual data of this section with the Wikipedia API?

It's not an empty section, it's a section that contains the 2014 FIFA World Cup Goalscorers template. You need to get this template's content: http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Template:2014%20FIFA%20World%20Cup%20Goalscorers&rvprop=content
But oh shi~~, it's a redirect to another template called 2014 FIFA World Cup goalscorers (note the difference!), so you need to get its content too: http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Template:2014%20FIFA%20World%20Cup%20goalscorers&rvprop=content

Related

Amazon MWS Country of origin

Amazon want the country of origin for Post_product_data.
Does anyone knows the XML build for post_product_data with CountryOfOrigin?
I Dont find anything in the documation.
Maybe anyone can help.
Kind regards
Christoph
Simply add inside "DescriptionData" the node <CountryOfOrigin>[a-zA-Z][a-zA-Z]</CountryOfOrigin> with two letters nation isocode:
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<Product>
<SKU>BJ0179032500</SKU>
<StandardProductID>
<Type>EAN</Type>
<Value>0074514690323</Value>
</StandardProductID>
<ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
<Condition>
<ConditionType>New</ConditionType>
</Condition>
<DescriptionData>
<Title>
<![CDATA[ title ]]>
</Title>
<Brand>
<![CDATA[ brand ]]>
</Brand>
<Description>
<![CDATA[ description]]>
</Description>
<MerchantCatalogNumber>BJ0179032500</MerchantCatalogNumber>
<MaxOrderQuantity>1000</MaxOrderQuantity>
<Manufacturer>Brand</Manufacturer>
<CountryOfOrigin>IT</CountryOfOrigin>
</DescriptionData>
</Product>
</Message>
Not using two letters isocode cause error:
vc-pattern-valid: Value 'xxxx' is not facet-valid with respect
to pattern '[a-zA-Z][a-zA-Z]' for type 'CountryOfOriginType'

Adding Community Members to a community activity using the REST API gives 403

We want to add community members (as author) to a community activity.
We see that both on prem and in Connections Cloud, that we get a 403 error.
I have reproduced this using the SBT playground (https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/Explorer.xsp#)
This is the XML that we post:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<id>test1234</id>
<contributor>
<name>Test User/name>
<snx:userid>TestID</snx:userid>
<snx:role>member</snx:role>
<snx:userState>active</snx:userState>
</contributor>
<title>Test User</title>
<updated>2016-03-04T09:25:17Z</updated>
<summary type="text">Member profile for Test User</summary>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="person"> </category>
<snx:role component="http://www.ibm.com/xmlns/prod/sn/activities">member</snx:role>
</entry>
To the Endpoint for activities: https://apps.na.collabserv.com/activities/service/atom2/acl?activityUuid=a750558c-d555-474d-8fcf-c3577276e9af
When we work "on-prem" we don't get error when we add community owners to the activity. Only when we (try to) add community members this 403 error occurs.
When we perform the action through the UI, there are no issues
We finaly have managed to add community members (not owners) to community_activity programmatically in IBM Connections.
When creating a community activity, Ibm Connections adds groups (as role) to community activities. If you want to add a specific member to your activity as an editor/reader, then you have to tell IBM Connections what role you want to give the other members from the group.
Can you try with below api and I am also attaching sample body you should be posting.
API : https://apps.na.collabserv.com/communities/service/atom/community/members?communityUuid=
Body
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<contributor>
<email>mkataria#in.ibm.com</email>
<snx:userid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">202432348</snx:userid>
<snx:userState xmlns:snx="http://www.ibm.com/xmlns/prod/sn">active</snx:userState>
<snx:isExternal xmlns:snx="http://www.ibm.com/xmlns/prod/sn">false</snx:isExternal>
<name>Manish Kataria</name>
</contributor>
<snx:role xmlns:snx="http://www.ibm.com/xmlns/prod/sn" component="http://www.ibm.com/xmlns/prod/sn/communities">owner</snx:role>
<category term="person" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="business-owner" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<snx:orgId xmlns:snx="http://www.ibm.com/xmlns/prod/sn">186</snx:orgId></entry>
Make sure content type is application/atom+xml
Sorry I missed the activity part, can you try below and share the exact error you get if any.
API : /activities/service/atom2/acl?activityUuid=
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<contributor>
<email>abc#org.com</email>
</contributor>
<category scheme="http://www.ibm.com/xmlns/prod/sn/type" term="person" />
<snx:role component="http://www.ibm.com/xmlns/prod/sn/activities">member</snx:role>
</entry>

Batch processing Google Contact Groups with API (php)

I'm trying to do batch processing of Google Contact groups. I have batch processing working for the actual contacts, but groups are not behaving. The XML that I send to Google is:
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:gContact='http://schemas.google.com/contact/2008'
xmlns:gd='http://schemas.google.com/g/2005'
xmlns:batch='http://schemas.google.com/gdata/batch'>
<entry>
<batch:id>create</batch:id>
<batch:operation type='insert'/>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/contact/2008#group'/>
<title type='text'>Status:Followup 1</title>
<content type='text'>Status:Followup 1</content>
</entry>
</feed>
The response I got back from google was:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:batch="http://schemas.google.com/gdata/batch"
xmlns:gContact="http://schemas.google.com/contact/2008"
xmlns:gd="http://schemas.google.com/g/2005">
<id>https://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/full/batch/1430425819721000</id>
<updated>2015-04-30T20:30:19.721Z</updated>
<title type="text">Batch Feed</title>
<entry gd:etag=""SHs-ezVSLit7I2A9XRVTFE8PTwU."">
<batch:id>create</batch:id>
<batch:operation type="insert"/>
<batch:status code="201" reason="Created."/>
<id>http://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/base/4b9f4f69095d670d</id>
<updated>2015-04-30T20:30:19.553Z</updated>
<app:edited xmlns:app="http://www.w3.org/2007/app">2015-04-30T20:30:19.553Z</app:edited>
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#contact"/>
<title/>
<content>Status:Followup 1</content>
<link rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*"
href="https://www.google.com/m8/feeds/photos/media/awallace%40ihouseweb.com/4b9f4f69095d670d"/>
<link rel="self" type="application/atom+xml" href="https://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/full/4b9f4f69095d670d"/>
<link rel="edit" type="application/atom+xml"
href="https://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/full/4b9f4f69095d670d"/>
</entry>
</feed>
(note, there were actually 4 groups in my batch, but the results were identical).
The groups in my account were unchanged. I have successfully added and deleted groups one at a time (without the batch syntax/url). The result XML here says explicitly that the group was created (), but the title element is empty in the return. ()
Any ideas?
Thanks,
Andy
I had a similar problem when batch creating groups. My problem was I had no entry for gd:extendedProperty:
eg:
<?xml version="1.0"?>
<feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" xmlns:gContact="http://schemas.google.com/contact/2008" xmlns:batch="http://schemas.google.com/gdata/batch">
<entry>
<batch:id>create</batch:id>
<batch:operation type="insert"/>
<atom:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#group"/>
<atom:title type="text">Test 1</atom:title>
<gd:extendedProperty name="Test 1">
<info>Test 1</info>
</gd:extendedProperty>
</entry>
...
</feed>
The XML markup you have appears to be for updating an existing group. Have a look at the documentation for more info:
https://developers.google.com/google-apps/contacts/v3/#batch_operations_for_contact_groups

Does the Wikipedia API support searches for a specific template?

Is it possible to query the Wikipedia API for articles that contain a specific template? The documentation does not describe any action that would filter search results to pages that contain a template. Specifically, I am after pages that contain Template:Persondata. After that, I am hoping to be able to retrieve just that specific template in order to populate genealogy data for the openancestry.org project.
The query below shows that the Albert Einstein page contains the Persondata Template, but it doesn't return the contents of the template, and I don't know how to get a list of page titles that contain the template.
http://en.wikipedia.org/w/api.php?action=query&prop=templates&titles=Albert%20Einstein&tlcontinue=736|10|ParmPart
Returns:
<api>
<query>
<pages>
<page pageid="736" ns="0" title="Albert Einstein">
<templates>
...
<tl ns="10" title="Template:Persondata"/>
...
</templates>
</page>
</pages>
</query>
<query-continue>
<templates tlcontinue="736|10|Reflist"/>
</query-continue>
</api>
I suspect that I can't get what I need from the API, but I'm hoping I'm wrong and that someone has already blazed a trail down this path.
You can use the embeddedin query to find all pages that include the template:
curl 'http://en.wikipedia.org/w/api.php?action=query&list=embeddedin&eititle=Template:Persondata&eilimit=5&format=xml'
Which gets you:
<?xml version="1.0"?>
<api>
<query>
<embeddedin>
<ei pageid="307" ns="0" title="Abraham Lincoln" />
<ei pageid="308" ns="0" title="Aristotle" />
<ei pageid="339" ns="0" title="Ayn Rand" />
<ei pageid="340" ns="0" title="Alain Connes" />
<ei pageid="344" ns="0" title="Allan Dwan" />
</embeddedin>
</query>
<query-continue>
<embeddedin eicontinue="10|Persondata|595" />
</query-continue>
</api>
See full docs at mediawiki.org.
Edit Use embeddedin query instead of backlinks (which doesn't cover template inclusions)
Using embeddedin does not allow you to search for a specific person, the search string becomes the Template:Persondata.
The best way I've found to get only people from Wikipedia is to use list=search and filter the search using AND"Born"AND"Occupation":
http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch="Tom Cruise"AND"Born"AND"Occupation"&format=jsonfm&srprop=snippet&srlimit=50`
Remember that Wikipedia is using a search engine that doesn't yet allow us to search only the title, it will search the full text. You can take advantage of that to get more precise results.
The accepted answer explains how to list pages using a certain template, but if you need to search for pages using the template, you can with the hastemplate: search keyword: https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=hastemplate:NPOV%20physics

vxml: defining grammars with equivalent inputs

I am using an engine based on TellMe. I have seen examples of grammars where the user can say one of a few different things that are considered the same. However, all the examples i've seen have been for in-line grammars (which dont work with the vxml engine im using). I want to know how i can change my .grxml file to do this. This is the file:
<?xml version="1.0"?>
<!-- created by Matthew Murdock. Grammars for speech rec menus -->
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" xml:lang="en" version="1.0" mode="voice" scope="dialog" tag-format="semantics/1.0.2006">
<rule id="keep">
<one-of>
<item>exit</item>
<item>exit the system</item>
<item>another</item>
<item>another mailbox</item>
<item>play</item>
<item>play back</item>
</one-of>
</rule>
</grammar>
instead of having 6 items, i want to have 3 items, each having two possible utterances. Any ideas on how i can do this?
A more compact form:
<rule id="exit">
exit <item repeat="0-1">the system</item>
<tag>out.result = "exit"</tag>
</rule>
<rule id="play">
play <item repeat="0-1">back</item>
<tag>out.result = "play"</tag>
</rule>
The answers you want are in the SISR specification which provides a mechanism for attaching meaning to input paths. Rewriting your example:
<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" xml:lang="en" version="1.0" mode="voice" scope="dialog" tag-format="semantics/1.0-literals">
<rule id="keep">
<one-of>
<item>
<one-of>
<item>exit</item>
<item>exit the system</item>
</one-of>
<tag>exit</tag>
</item>
<item>
<one-of>
<item>another</item>
<item>another mailbox</item>
</one-of>
<tag>another</tag>
</item>
<item>
<one-of>
<item>play</item>
<item>play back</item>
</one-of>
<tag>play</tag>
</item>
</one-of>
</rule>
</grammar>
Several things to know:
I chose the literal tag format (notice the tag-format attribute of the grammar element). It could have also been implemented using "semantics/1.0" and the contents of the tag would have looked like: out="exit";
TellMe tag-format values may need to be different, but their development guide implies they follow the standards.
Once you have it working, don't hesitate to create filler grammars (in SRGS speak, rules). Filler rules would be rules without any SI (no tag elements) and contain common phrases people add to responses. For example, a trailing rule that could be added at the end of your grammar:
</one-of>
<item repeat="0-1"><ruleref uri="#trailing"/></item>
</rule>
<rule id="trailing>
<one-of>
<item>please</item>
<item>thank you</item>
</one-of>
</rule>
</grammar>
This would support more natural types of responses. This may or may not be important depending on your calling base. Filler grammars can be very large, but tend to be highly reusable. You can also add filler at the beginning of input. In rich speech applications, a the most significant gain in the tuning process involves updating the grammar to contain the actual phrases spoken by the caller versus what the developer or VUI designer thought would be spoken.
I figured it out. I changed my grammar to look like this:
<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" xml:lang="en" version="1.0" mode="voice" scope="dialog" tag-format="semantics/1.0-literals">
<rule id="keep">
<one-of>
<item><ruleref id="#exit"/></item>
<item><ruleref id="#play"/></item>
</one-of>
</rule>
<rule id="exit">
<one-of>
<item>exit</item>
<item>exit the system</item>
</one-of>
<tag>out.result = "exit"</tag>
</rule>
<rule id="play">
<one-of>
<item>play</item>
<item>play back</item>
</one-of>
<tag>out.result = "play"</tag>
</rule>
</grammar>
Then, back in my script instead of basing my actions on callerInput (the variable specified in the <field> tag), i based them off of callerInput$.interpretation which holds xml containing whatever i assigned out.result to in the <tag> element of the grammar.
I guess it makes sense to base your actions on the "interpretation" and not the caller's literal input.
NOTE: Because we are working with our own vxml engine we were able to create a method for extracting the interpretation value out of the xml.