EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB439515: How to use Get request to query data from REST Web Services in MicroStrategy XQuery Editor and Generator 10.x?


Tianfeng (Jimmy) Jiang

Quality Engineer, Principal • MicroStrategy


This article describes how to use Get request to query data from REST Web Services in MicroStrategy XQuery Editor and Generator 10.x

Strategy XQuery Editor and Generator (XEG) 10.x generates XQuery script with POST method to query data from REST Web services by default as shown below:

ka02R000000kV3vQAE_0EM44000000QGJr.png

While, POST method is not supported by some REST Web services and error might pop up when executing such XQuery . It's possible to workaround this issue with some user-defined or third-party functions which use GET method instead. For example, some Zorba functions outlined in page below could be used:
http://cf.zorba-xquery.com.s3.amazonaws.com/doc/zorba-0.9.4/zorba/html/rest.html 
Here is one sample code with Zorba get() function:
 


import module namespace zorba-rest = "http://www.zorba-xquery.com/zorba/rest-functions";
declare copy-namespaces no-preserve, no-inherit;
declare namespace mstr-rest = 'http://www.Strategy.com/xquery/rest-functions';
declare function mstr-rest:post($uri,$payload,$header) external;


let $uri := ('http://was-tjiang.corp.Strategy.com:8080/polls/')
let $header := ( )
let $payload := ( )
let $result := zorba-rest:get($uri,$payload,$header)


return 
<Table><ColumnHeaders>
<ColumnHeader  name='title' type='xs:string' />
</ColumnHeaders>
<Data>{for $ancestor in $result//books/book
return <Row>
<title>{fn:data($ancestor/title)}</title>
</Row>}</Data></Table>

KB439515


Comment

0 comments

Details

Knowledge Article

Published:

January 22, 2018

Last Updated:

December 6, 2018