cancel
Showing results for 
Search instead for 
Did you mean: 

Analytical Reporting API - Filters error

0 Kudos
1,462
Hi experts,

I have a problem:

I am trying to test the Analytical Reporting API and the ViewTemplates.

I have created the following ViewTemplate:

{
 "viewTemplateName": "testTemplate8",
 "type": "custom",
 "status": "published",
 "documentType": "SourcingProjectFact",
 "selectAttributes": [
 "ProjectId",
 "BaselineSpend",
 "ExecutionStrategy",
 "TimeCreated",
 "Region.Region",
 "Organization.Organization",
 "Commodity.Commodity",
 "ProjectInfo",
 "Currency"
 ],
 "filterExpressions": [
 {
 "name": "myProjId",
 "field": "ProjectId",
 "op": "=",
 "defaultValue": null
 }
 ]
}

The template is working with the default value when I call it:

https://eu.openapi.ariba.com/api/analytics-reporting-view/v1/prod/views/testTemplate8?realm={myRealm...

It shows all possible entries as it should.

Now I want to overwrite the default value in my request:

https://eu.openapi.ariba.com/api/analytics-reporting-view/v1/prod/views/testTemplate8?realm={myRealm...;

This request is leading to an Error-response:

{
 "code": "invalidFilterStructure",
 "message": "Invalid filter structure. null"
}

Please help me to fix the problem.

Accepted Solutions (1)

Accepted Solutions (1)

SeanMcGann
Product and Topic Expert
Product and Topic Expert

Hi TB,

Can you please put {} around your filter? filters={"myProjId":"WS302297384"} and let us know if this works for you?

ajmaradiaga
Developer Advocate
Developer Advocate

tim92, following on sean.mcgann3's advice.... it is possible that you might also need to escape the curly brackets, see example below.

{ -> %7B
} -> %7D
" -> %22

Postman:

curl command:

curl --location --request GET 'https://openapi.ariba.com/api/analytics-reporting-view/v1/prod/views/S4ApprovalFlowFactSystemView?realm=myrealm-T&filters=%7B%22updatedDateFrom%22:%222020-09-01T00:00:00Z%22,%22updatedDateTo%22:%222020-11-22T00:00:00Z%22%7D' \
--header 'apiKey: [YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]'
TuncayKaraca
Active Contributor
0 Kudos

Thank you all, that's what I needed with SAP Ariba Analytical Reporting API.

Answers (1)

Answers (1)

Thank you for your input sean.mcgann3 & ajmaradiaga . This solved the problem. It seems that it is it mandatory to escape the special characters as Antonio suggested.

I also found out that you can request more than one ProjectID if the FilterExpressions are defined with the "IN" operator in the view-template. Then the syntax for the reqest would be: &filters=%7B"myProjId":%5B"<ID1>","<ID2>"%5D%7D

Maybe that could help someone else having trouble with it.

Best regards