Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3132

Re: How to create a new Document with Data Provider through RESTful API

$
0
0

Thank you for your suggestions, but in the end it turned out that I wasn't creating data provider query properly. The correct way was to edit Query Specification.

 

So, the way it works now, is this:

 

Steps 1-3 are the same.

 

4) Update Query Specification

 

Request:

  PUT /biprws/raylight/v1/documents/2168171/dataproviders/DP0/specification HTTP/1.1

  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <queryspec:QuerySpec xmlns:queryspec="http://com.sap.sl.queryspec" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     dataProviderId="DP0">

     <queryParameters>

     <duplicatedRowsProperty activated="true" value="true"/>

     <maxRetrievalTimeInSecondsProperty value="300"/>

     <maxRowsRetrievedProperty value="90000"/>

     <removeEmptyRowsProperty activated="true" value="true"/>

     <allowOtherUserToEditQueryProperty activated="true" value="true"/>

     <resetContextOnRefreshProperty activated="true" value="true"/>

     <stripQueryProperty/>

     <useBexQueryDefaultValue activated="true" value="true"/>

     </queryParameters>

     <queriesTree xsi:type="queryspec:QueryDataNode">

     <bOQuery identifier="8ef6c40e-fa03-4b18-af56-c6596e8a4a4f" name="Query">

     <resultObjects identifier="DS0.DOda" name="State"/>

     <resultObjects identifier="DS0.DOa6" name="City"/>

     </bOQuery>

     </queriesTree>

     <propertyBag key="DUPLICATED_ROWS_UNDEFINED_VALUE" value="-1"/>

     <propertyBag key="RESET_CONTEXT_ON_REFRESH_UNDEFINED_VALUE" value="-1"/>

     <propertyBag key="ALLOW_THE_USER_TO_EDIT_QUERY_UNDEFINED_VALUE" value="-1"/>

  </queryspec:QuerySpec>

Result:

  HTTP/1.1 200 OK

  {"success":

    {"message":"The resource of type \"Data provider\" with identifier \"DP0\" has been successfully updated.",

    "id":"DP0"}

  }

 

5) Save document

 

Request:

PUT /biprws/raylight/v1/documents/2168171 HTTP/1.1

{"document": {

  "name": "eFashion document",

  "folderId": 2128036
}}

Result:

  HTTP/1.1 200 OK

  {"success":

    {"message":"The resource of type \"Document\" with identifier \"2168171\" has been successfully updated.",

    "id":2168171}

  }

 

Resulting document has Data Provider that looks like this:

 

{

  "dataprovider": {

   "id": "DP0",

   "name": "Query 1",

   "dataSourceId": 5085,

   "dataSourcePrefix": "DS0",

   "dataSourceType": "unv",

   "duration": 0,

   "isPartial": false,

   "rowCount": 0,

   "flowCount": 1,

   "dictionary": {

   "expression": [

  {

   "@qualification": "Dimension",

   "@dataType": "String",

   "id": "DP0.DOa6",

   "name": "City",

   "description": "City located.",

   "dataSourceObjectId": "DS0.DOa6",

   "formulaLanguageId": "[City]"
   },

  {

   "@qualification": "Dimension",

   "@dataType": "String",

   "id": "DP0.DOda",

   "name": "State",

   "description": "State located.",

   "dataSourceObjectId": "DS0.DOda",

   "formulaLanguageId": "[State]"
   }

  ]

  },

   "query": "SELECT Outlet_Lookup.State, Outlet_Lookup.City FROM Outlet_Lookup"
  }

}

 

The document itself if you export it still isn't completely identical - the visual representation of a table is missing. From what I've gathered it can be created by adding required Report / Report Elements but I haven't tried it at this point since it isn't necessary for my project.


Viewing all articles
Browse latest Browse all 3132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>