(DI-1711) SAP HANA XS application API

Copyright

This manual and its content is copyright of DataVard GmbH – © DataVard 2017. All rights reserved.

Any redistribution or reproduction of part or all of the contents in any form is prohibited other than the following:

  • You may print or download to a local hard disk extracts for your personal and non-commercial use only.
  • You may copy the content to individual third parties for their personal use, but only if you acknowledge this document as the source of the material.

You may not, except with our express written permission, distribute or commercially exploit the content. Nor may you transmit it or store it in any website or other form of electronic retrieval system.

SAP, ABAP, SAP Business Suite, SAP ERP, SAP Customer Relationship Management (SAP CRM), SAP ERP Human Capital Management (SAP ERP HCM), SAP ERP Operations, SAP ERP Financials, SAP Product Lifecycle Management (SAP PLM), SAP Supplier Relationship Management (SAP SRM), SAP Supply Chain Management (SAP SCM), SAP Business One, SAP Business All-in-One, SAP NetWeaver Business Intelligence (SAP NetWeaver BI), SAP NetWeaver Master Data Management, SAP NetWeaver, SAP Solution Manager, SAP Exchange Infrastructure (SAP NetWeaver XI) SAP Business Information Warehouse (SAP BW), SAP Strategic Enterprise Management (SAP SEM), SAP R/3, SAP R/3 Enterprise, SAP Business ByDesign, SAP BusinessObjects GRC Global Trade Services, SAP GTS are the trademarks or registered trademarks of SAP AG in Germany and in several other countries.

Overview

XS application consist of exposed oData service and additional XSJS scripts that handle mass insertion and mass deletion of file content. File indexing agents are using XS application to store parsed data for further processing. Upload of content from agents HTTP protocol is used. This document describing interfaces that can be used by external file indexing agents.

File indexing service API

File indexing service is implemented using 2 services:

  • XSODATA service
    • Used for full-text search in files
    • Also possible to create files and rows, but for more convenient API xsjs service is more suitable
  • XS javascript (XSJS) service
    • Used for creating files, appending rows, etc.

Service authorizations

Indexing agent application should use database user with assigned role 'dvd.filesearch.roles::agent'.

Technical information

ParamterValue
Application namespacedvd.filesearch.FileIndex
Service path to oData service/dvd/filesearch/FileIndex.xsodata

Implementation of File indexing agent

Analyzed file should be parsed by file index agent in way where one row contains information (string) about one event from analyzed file. File agent should be able to identify time of particular event and get information for this event. 


In example: We have following file content:

2017-08-16 16:21:21 System is overloaded
2017-08-16 16:21:56 System is OK again

File indexing agent should be able parse file into 2 rows where first row will be parsed into:

  • timestamp: 20170816162156
  • content: 2017-08-16 16:21:21 System is overloaded


Workflow for implementation File Indexing agent is following:

  • Create File origin (id of location where file original resides) using OData entity FileOrigin

    dvd.filesearch::FileIndex.FileOrigin

    Origin header table where all origin definition are stored.

    FieldKeyTypeDescription
    idXNVARCHAR 32Unique identifier of file origin (i.e. system name where files are coming from)
    name
    NVARCHAR 128
    Name of origin
    host
    NVARCHAR 128
    Server host
  • Create File (full path of file location) using OData entity File

    dvd.filesearch::FileIndex.File

    File header table where all file definitions are stored.

    FieldKeyTypeDescription
    idXINTEGERUnique identifier of file automatically assigned during entry creation
    guid
    NVARCHAR 32Unique identifier of file given by File Indexing agent application
    name
    NVARCHAR 255Full name of file (including full path in origin)
    origin.id
    32File origin
    fileType
    100Type of file
  • Create File content using XSJS script /dvd/filesearch/addFileRows.xsjs  

    dvd.filesearch::FileIndex.FileData

    Data that represent content of defined files. 

    FieldKeyTypeDescription
    fileIdXINTEGERUnique identifier of file
    rowNumXINTEGERRow number of record
    timestamp
    TIMESTAMPTime stamp of record
    content
    CLOBString content of record

XSODATA service

CDS are exposed to oData entities using XSODATA definition file. OData are mainly used by SAPUI5 application and File indexing agent.

TableoData entityPath
dvd.filesearch::FileIndex.FileOriginFileOrigin/dvd/filesearch/FileIndex.xsodata/FileOrigin
dvd.filesearch::FileIndex.FileFile/dvd/filesearch/FileIndex.xsodata/File
dvd.filesearch::FileIndex.FileDataFileData/dvd/filesearch/FileIndex.xsodata/FileData
dvd.filesearch::FileIndex.FileViewFileView/dvd/filesearch/FileIndex.xsodata/FileView

More information about properties can be found from metadata of service: 

/dvd/filesearch/FileIndex.xsodata/$metadata/

XSJS service

All request should contain following headers and cookies gathered during initial fetch of X-CSRF-Token token.

HeaderValue
X-CSRF-Token

<Fetched token>

Acceptapplication/json
Content-Typeapplication/json

addFileRows.xsjs

Script path

/dvd/filesearch/addFileRows.xsjs

Request

HTTP method: POST

Request body content example:

{
	"guid": "CB1D315DD10C334792A32702B834DAF6",
	"rows": [	{"timestamp":"20170321103106","content":"2017-03-21 10:31:06 Show me the way to the next whisky bar"},
			{"timestamp":"20170321103106","content":"2017-03-21 10:31:06 and don't ask why, and don't ask why"},
			{"timestamp":"20170321103106","content":"2017-03-21 10:31:06 What if we don't find the next whisky bar?"},
			{"timestamp":"20170321103106","content":"2017-03-21 10:31:06 I'll tell you we must die, I'll tell you we must die!"}
			]
}

Response

Data are successfully added when response contains HTTP code 2* and response body should look as follows:

{"result":"OK"}

deleteFileRows.xsjs

Script path

/dvd/filesearch/deleteFileRows.xsjs

Request

HTTP method: POST

Request body content example:

{
	"guid": "CB1D315DD10C334792A32702B834DAF6"
}

Where guid is identificator of file in which content should be deleted.

Response

Data are successfully deleted when response contains HTTP code 2* and response body should look as follows:

{"result":"OK"}