Qlikview REST connector pagination namespaced XML - rest

We have a XML file that is on somewebsite and looks in a way like this (confidential parts stripped)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://somewebsite.com/crm/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
<title type="text">Accounts</title>
<id></id>
<updated>2016-02-04T08:36:56Z</updated>
<link rel="self" title="Accounts" href="Accounts" />
<entry>
<title type="text"></title>
<updated>2016-02-04T08:36:56Z</updated>
<author>
<name />
</author>
<content type="application/xml">
<m:properties>
<d:Type>A</d:Type>
<d:UniqueTaxpayerReference m:null="true" />
<d:VATLiability m:null="true" />
<d:VATNumber m:null="true" />
<d:Website m:null="true" />
</m:properties>
</content>
</entry>
<link rel="next" href="https://somewebsite.com/Accounts?$skiptoken=guid'ee6bc390-a8ac-4bbd-8a4d-0a1f04ab9bd3'" />
</feed>
We use the new Rest connector to get the data out of this XML file.
The XML has pagination and every 60 entries you can load the next 60 with the link at the bottom of this xml file.
The problem i have is when, in the REST connector, we want to enable pagination with these setting:
Pagination Type: Next URL
Next URL field path:
/*[name()="feed"]/*[name()="link"][contains(#rel,"next")]/#href
It doesn't seem to work...
side note: the XML file has namespaces so i need to target the elements this way instead of /feed/link/...
I'm using Xpath syntax to target the link href, but maybe this is not the way to go? Or maybe the REST connector isn't using Xpath syntax?
Really hope someone can help me!

Actually it turns out that this seems to be due to a "bug" in the "Qlik REST Connector 1.0" so the pagination doesn't work.
But there is a fix for it:
1) Make sure that the Qlik REST Connector 1.0 connect dialog box has the NextUrl set to:
feed/link/attr:href
2) When the SQL has been generated after using the SELECT-button and going through the wizard you have to modify the sub-SELECT that reads like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href" AS href,
"__FK_link"
FROM "link" FK "__FK_link"),
.....
On line 05 you will have to remove the text AS href.
So it should look like this:
.....
(SELECT
"attr:rel" AS "rel",
"attr:title" AS "title",
"attr:href",
"__FK_link"
FROM "link" FK "__FK_link"),
....
3) Find the LOAD statement that loads from this sub-select with a RESIDENT [MasterREST further down in the load script and make sure that the reference to href is changed to [attr:href] - or else you will get an error message while loading.
Should look like this after the change:
[link]:
LOAD [rel],
[title],
[attr:href],
[__FK_link] AS [__KEY_feed]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__FK_link]);

This worked for me:
/*[name()='feed']/*[name()='link'][#rel='next']/#href
Yours should also work actually, maybe whatever you are using does not agree with double quotes instead of single quotes.

Related

How to Add additional columns to links page to ExternalLink types

How to add columns to ExternalLink on the "Links" page on Azure DevOps Workitem ?
Answered : Not Possible see answer below
Pull Request is not like Code Review Request, it's not a work item
type, we cannot see it from the exported process template. So, I don't
think we can customize the columns like the common work item types. –
Andy Li-MSFT
after going through the following links
link1
link2
and trying the workaround discussed here
I have failed to add more columns to links of the type externallink
i have added the following code as described:
<Page Label="Links" LayoutMode="FirstColumnWide">
<Section>
<Group Label="links">
<Control Type="LinksControl" Name="links">
<LinksControlOptions>
<LinkFilters>
<ExternalLinkFilter Type="Build" />
<ExternalLinkFilter Type="Integrated in build" />
<ExternalLinkFilter Type="Pull Request" />
<ExternalLinkFilter Type="Branch" />
<ExternalLinkFilter Type="Fixed in Commit" />
<ExternalLinkFilter Type="Fixed in Changeset" />
<ExternalLinkFilter Type="Source Code File" />
<ExternalLinkFilter Type="Found in build" />
<ExternalLinkFilter Type="GitHub Pull Request" />
<ExternalLinkFilter Type="GitHub Commit" />
</LinkFilters>
<Columns>
<Column Name="System.State" />
<Column Name="System.ChangedDate" />
<Column Name="System.PullRequest.IsFork" />
</Columns>
</LinksControlOptions>
</Control>
</Group>
</Section>
</Page>
But the results still show only the original columns.
The problem is that the field/column you added (<Column Name="System.PullRequest.IsFork" />) is not a valid work item filed/column. The workaround is only available for work item types due to the columns depend on work item fields.
You need to add a valid work item field/column here. We can get all the available work item fields by calling the Get Work Item REST API with parameter $expand=Fields added in the URL from a specific work item.
GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?$expand=Fields&api-version=4.1
For example, the following screenshots shows all the available fields for my Task work item. (It depends on how you defined the fields, if you defined a custom field, you can also see it from the response body.):
After that, we can add the columns (System.CreatedBy and Microsoft.VSTS.Common.Priority for example in this sample)
Then check the behavior in a Task work item:
Please note that, Pull Requests is not a work item type. We cannot get valid work item fields by calling the Pull Requests REST API. In this case, I don't think we can customize the columns like the common work item types.

Title element doesn't work with Action Element in Manifest XML

I am creating an add-in for Microsoft Word.
I am getting manifest validation error for Title element inside Action element.
Microsoft Reference documentation for Action Element
Error #1:
XML Schema Violation: Your manifest does not adhere to the current set of XML schema definitions for Office Add-in manifests. (link: https://aka.ms/add-in-manifest-schema-violation)
- Details: The element 'Action' in namespace 'http://schemas.microsoft.com/office/taskpaneappversionoverrides' has invalid child element 'Title' in namespace 'http://schemas.microsoft.com/office/taskpaneappversionoverrides'. List of possible elements expected: 'TaskpaneId, SourceLocation' in namespace 'http://schemas.microsoft.com/office/taskpaneappversionoverrides'.
- Line: 54
- Column: 22
Example:
<Action xsi:type="ShowTaskpane">
<Title resid="Contoso.Taskpane.Title" /> --> //Adding this line throws error
<TaskpaneId>ButtonId1</TaskpaneId>
<SourceLocation resid="Contoso.Taskpane.Url" />
</Action>
Could someone help me here?
The validator checks the order in which the XML elements appear.
Please use the code below:
<Action xsi:type="ShowTaskpane">
<TaskpaneId>ButtonId1</TaskpaneId>
<SourceLocation resid="Contoso.Taskpane.Url" />
<Title resid="Contoso.Taskpane.Title" /> -->
</Action>

Adding a VersionOne expression using the REST API

I am trying to create a new 'Expression' in VersionOne - effectively adding a new 'comment' to a conversation.
In theory, the rest-1.v1/Data API should allow this, but I can't figure out how to do it - there is precious little documentation about using the API (using POST) to create objects.
FWIW, here's what I'm doing (after successfully accessing the server with valid credentials):
URL:
/rest-1.v1/Data/Expression
XML:
<Asset href="<Server Base URI>/rest-1.v1/Data/Expression">
<Attribute name="AssetType">Expression</Attribute>
<Relation name="InReplyTo" />
<Attribute name="AuthoredAt">2014-05-28T21:48:37.940</Attribute>
<Attribute name="Content">A new comment</Attribute>
<Attribute name="AssetState">64</Attribute>
<Relation name="Author">
<Asset href="<Server Base URI>/rest-1.v1/Data/Member/2015" idref="Member:2015" />
</Relation>
<Relation name="BelongsTo">
<Asset href="<Server Base URI>/rest-1.v1/Data/Conversation/2018" idref="Conversation:2018" />
</Relation>
<Attribute name="Author.Name">user#example.com</Attribute>
<Attribute name="Author.Nickname">User Name</Attribute>
<Relation name="Mentions">
<Asset href="<Server Base URI>/rest-1.v1/Data/Story/2017" idref="Story:2017" />
</Relation>
</Asset>
I keep getting a 400 Bad Request the following error:
<Error href="<Server Base URI>/rest-1.v1/Data/Expression">
<Message>Violation'Required'AttributeDefinition'Content'Expression</Message>
<Exception class="VersionOne.DataException">
<Message>Violation'Required'AttributeDefinition'Content'Expression</Message>
</Exception>
</Error>
I assume I'm missing something obvious - does anyone know what it is?
IF you examine the metadata for a VersionOne Expression, you will see 3 required fields (Author,AuthoredAt,Content). Logically this makes sense to be able to just create a single, zombie expression but I witnessed otherwise. This might be a mistake in the stylesheet or just my browser because it seems POSTing with only those three will return a 400 error. To get a guaranteed working payload, include the relation "inReplyTo" and that is all that you will need to create an expression within the context of a particular Conversation.
Given that you are responding to an existing expression (comment) This should work fine.
POST to rest-1.v1/Data/Expression
<Asset>
<Relation name="Author" act="set">
<Asset idref="Member:2015" />
</Relation>
<Attribute name="AuthoredAt">2014-05-02T21:48:37.940</Attribute>
<Attribute name="Content" act="set">A new comment</Attribute>
<Relation name="InReplyTo" act="set">
<Asset idref="Expression:xxxxx" />
</Relation>
</Asset>
You don't need Asset state or mentions or belongs to. AssetState is readonly, and BelongsTo is filled in automatically after your Expression is created. It inherits a reference to the containing Conversation from the Expression object entered in the InReplyTo field and the Mentions relation is optional.
FYI,
I believe that you didn't see the Legend on the right hand side of a the meta query output as seen in a browser. Real quick here, when you do a meta query, the items with * are required to Post, Bold items are Read/Write optional, the italicized items are readonly, and the bold items towards the bottom that are appended with ": operation" is the operation that you are allow to do against that particular asset.

Wikipedia API: how to retrieve multiple titles AND resolve redirects in 1 call?

It appears from the MediaWiki API:Query page that you can only resolve a redirect one at a time.
The document even says "The example below isn't really useful because it doesn't use any query modules, but shows how the redirects parameter works."
But how can you get the redirect information -- using a query module that does return multiple results?
If you have any result that returns pages, then you can just append redirects to the query and it resolves the redirects. If you don't have results that returns pages, you can usually convert it to that by using a generator.
For example, the query
http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Redirects_from_gender&redirects
returns something like (shortened)
<api>
<query>
<categorymembers>
<cm pageid="648" ns="0" title="Actress" />
<cm pageid="19887132" ns="0" title="Administratrix" />
</categorymembers>
</query>
</api>
If you convert that into a generator
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Redirects_from_gender
you get
<api>
<query>
<pages>
<page pageid="648" ns="0" title="Actress" />
<page pageid="19887132" ns="0" title="Administratrix" />
</pages>
</query>
</api>
And if you now add redirects
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Redirects_from_gender&redirects
you get
<api>
<query>
<redirects>
<r from="Actress" to="Actor" />
<r from="Administratrix" to="Administrator (law)" />
</redirects>
<pages>
<page pageid="21504235" ns="0" title="Actor" />
<page pageid="6676496" ns="0" title="Administrator (law)" />
</pages>
</query>
</api>
You can also use prop=redirects with any generator, e.g. generator=allpages. This is a new feature since MW-1.23, fixing bug T59057.
When using generator=allpages with max limits (gaplimit=max and rdlimit=max) and apihighlimits right is available, all redirects on ArchWiki are resolved in a single query ;)
https://wiki.archlinux.org/api.php?action=query&generator=allpages&gapfilterredir=nonredirects&gaplimit=max&prop=redirects&rdprop=pageid|title|fragment&rdlimit=max

How to add a colorized HTML code snippet in Sandcastle documentation?

I am using the Sandcastle Help File Builder and would like to include colorized HTML code snippets in the "Conceptual Content". Is this possible and if so, how?
I have tried <code>, <codeExample>, and <sampleCode language="HTML" />.
The best result so far is to HTML-encode the sample HTML and place it in a .snippets file like so.
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="HTML">
<span>My Html</span>
</sampleCode>
</item>
</examples>
Then reference it in the .aml file.
<codeReference>htmlSnippet</codeReference>
I would prefer to have it colorized, but I can't figure out a way to add the formatting.
According to the MAML Guide, the proper way of doing this is to use a <code> tag with a CDATA section:
<code language="xml" title="Example Configuration">
<![CDATA[
<span>My Html</span>]]>
</code>
The contents of the CDATA section will be treated as a literal string, and indentation will be preserved.
I know this is old, but Sandcastle supports html as xml. I figured I should comment in case anyone else comes across this post as I did.
This should work:
<?xml version="1.0" encoding="utf-8" ?>
<examples>
<item id="htmlSnippet">
<sampleCode language="xml"><!CDATA[[
<span>My Html</span>
]]>
</sampleCode>
</item>
</examples>
If you're using Sandcastle Help File Builder, you may create your own syntax parser as described here and here, although xml is available by default... using the XAML filter's generator, which is defined here if you want to look at the config:
<generator type="Microsoft.Ddue.Tools.XamlUsageSyntaxGenerator"
assembly="{#SandcastlePath}ProductionTools\SyntaxComponents.dll">
<filter files="{#SandcastlePath}Presentation\Shared\configuration\xamlSyntax.config" />
</generator>
According to the SHFB documentation for the Code Block Component, you should be able to just use the <code>.
I got it to work without a problem; here's what I did:
test.html
<html>
<head>Something!</head>
<body>
<h1>Heading</h1>
<!-- #region myhtml -->
<p>Paragraph</p>
<div>Div for <strong>Good</strong> <em>measure</em>.</div>
<!-- #endregion -->
</body>
</html>
SomethingorOther.aml
<code language="html" source="../Examples/test.html" region="myhtml" />
Result:
Please note that in the preview, your sample will appear as unhighlighted XML, but when you build the documentation, everything should like just fine.