Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reportng/CSV] Write documentation for the new CSV endpoint #151745

Closed
tsullivan opened this issue Feb 21, 2023 · 2 comments
Closed

[Reportng/CSV] Write documentation for the new CSV endpoint #151745

tsullivan opened this issue Feb 21, 2023 · 2 comments
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead documentation Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) technical debt Improvement of the software architecture and operational architecture

Comments

@tsullivan
Copy link
Member

tsullivan commented Feb 21, 2023

Related to #148775

The new CSV export endpoint is designed to be more friendly for users creating their own automation. Some documentation will highlight the value of the new work.

A sample from the PR:

Using the endpoint outside of Kibana

A request to generate a report has a string of rison-encoded job parameters. The parameters can now be made into a template for customers to inject their own savedSearchID. The time range of the search, filters, and query can also be dynamically filled in at the time of requesting a report - much more easily than before.

ENDPOINT=/api/reporting/generate/csv_v2
SAVED_SEARCH_ID="d779c5d0-a1c3-11ed-bd60-6957c24fc275"
 
# Inject the search ID into the "jobParams" template
JOB_PARAMS="(browserTimezone:UTC,locatorParams:!((id:DISCOVER_APP_LOCATOR,params:(savedSearchId:'${SAVED_SEARCH_ID}',timeRange:(from:now-1M,to:now)))),objectType:search)"
 
# Send a request to generate a report
curl -XPOST $ENDPOINT \
  -H "${AUTH_HEADER}" \
  -H 'Content-Type: application/json' \
  -H 'kbn-xsrf: reporting' 
  -d '{ "jobParams": "'$JOB_PARAMS'"}'
@tsullivan tsullivan added the Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) label Feb 21, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

@tsullivan tsullivan added the (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead label Feb 21, 2023
tsullivan added a commit that referenced this issue Feb 22, 2023
## Summary

This new CSV endpoint will be usable for scripted reporting. As of this
PR, the endpoint is not going to be used in the UI: that will be handled
by [this issue](#151190). The
new endpoint is not documented yet, but should be once the endpoint is
used in the UI, according to [this
issue](#151745).

Depends on #150631
Closes #148775

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

## Using the endpoint from a script
A request to generate a report has a string of rison-encoded job
parameters. The parameters can now be made into a template for customers
to inject their own savedSearchID. The time range of the search,
filters, and query can also be dynamically filled in at the time of
requesting a report - much more easily than before.

```sh
SAVED_SEARCH_ID="d779c5d0-a1c3-11ed-bd60-6957c24fc275"
 
# Inject the search ID into the "jobParams" template
JOB_PARAMS="(browserTimezone:UTC,locatorParams:!((id:DISCOVER_APP_LOCATOR,params:(savedSearchId:'${SAVED_SEARCH_ID}',timeRange:(from:now-1M,to:now)))),objectType:search)"
 
# Send a request to generate a report
curl -XPOST $ENDPOINT \
  -H "${AUTH_HEADER}" \
  -H 'Content-Type: application/json' \
  -H 'kbn-xsrf: reporting' 
  -d '{ "jobParams": "'$JOB_PARAMS'"}'
```

## Limitations
A locator without a `savedSearchId` is currently not supported. Getting
that support will make it possible to create exports based on content in
Discover tied only to a Data View (unsaved search support).

## (Demo) Developer Example app
_The demo app is descoped from this PR_
~~This PR updates the Reporting example app to feature a "CSV Explorer."
In this app, you can select a saved search, build up a
DiscoverAppLocatorParams object, and send a request to generate a
report.~~


https://user-images.githubusercontent.com/908371/217356050-f556f897-33c6-4623-aa06-9af191378e48.mp4

## Release Note
We are skipping the release note for now, while waiting for
documentation.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@tsullivan tsullivan added technical debt Improvement of the software architecture and operational architecture documentation labels Jan 5, 2024
@tsullivan
Copy link
Member Author

This issue should be closed. The documentation will get updated either part of #151190 or another effort to revamp Reporting documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead documentation Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) technical debt Improvement of the software architecture and operational architecture
Projects
None yet
Development

No branches or pull requests

2 participants