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

Update API Example in backend to use the new /content/_search endpoint #19691

Closed
wezell opened this issue Dec 10, 2020 · 9 comments · Fixed by #19705
Closed

Update API Example in backend to use the new /content/_search endpoint #19691

wezell opened this issue Dec 10, 2020 · 9 comments · Fixed by #19705

Comments

@wezell
Copy link
Contributor

wezell commented Dec 10, 2020

We need to update this screen to show an example using the new /api/content/_search POST method

Screen Shot 2020-12-10 at 4 54 32 PM

The example should display a curl example like:

curl -XPOST 'http://localhost:8080/api/content/_search' \
--header 'Content-Type: application/json' \
--data-raw '{
      	 "query": "+structurename:webpagecontent",
       	 "sort":"modDate",
       	 "limit":20,
       	 "offset":0
 }'

but with the correct values filled in. Be careful of escaping quotes as well.

Additionally we can remove the link to the xml example and just have the json example link that does the actual post and displays the results, rather than the GET link we have now.

@john-thomas-dotcms
Copy link
Contributor

So just to be clear, I think we need to add a new example, not replace the existing one.

The existing example uses a GET, so it's easy to test from any browser, but I think the _search endpoint is a POST, which requires special tools (like postman). I think it's important that we keep a really easy to use example in there (without the need for a POST).

@john-thomas-dotcms
Copy link
Contributor

In addition, it might also be a good time to think about adding a GraphQL example in there as well. We have alot more customers using this now, so an easy to find example could be really useful for them.

@alfredo-dotcms
Copy link
Contributor

image
@wezell do you also want me to remove the XML href in the history tab? or just the one here:
https://user-images.githubusercontent.com/934364/101834754-bf49e400-3b08-11eb-8e06-913b1d1d76a2.png

alfredo-dotcms added a commit that referenced this issue Dec 15, 2020
A curl example needs to be added to the query dialog in content search portlet. Also the XML information link needs to be removed
@alfredo-dotcms
Copy link
Contributor

PR: #19705

@wezell
Copy link
Contributor Author

wezell commented Dec 15, 2020

Looking good - a few things

  • In the Dialog, let's wrap the code examples in a block and use a fixed width font.
  • Use the short curl args, e.g. -H for --header and -d for data-raw
  • Move the REST API Call URLEncoded below the post
  • Use the POST for the JSON link
  • replace the json for the link with the [API] icon
    Screen Shot 2020-12-15 at 11 50 58 AM

@alfredo-dotcms
Copy link
Contributor

@wezell done:
a86f7d6

@alfredo-dotcms
Copy link
Contributor

Preview
image

nollymar pushed a commit that referenced this issue Dec 16, 2020
* #19691 fix

A curl example needs to be added to the query dialog in content search portlet. Also the XML information link needs to be removed

* Feedback
@nollymar nollymar linked a pull request Dec 16, 2020 that will close this issue
@nollymar
Copy link
Contributor

Passed internal qa

@bryanboza
Copy link
Member

Fixed, tested on release-21.02 // Postgres // FF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants