Content Delivery API: Why Can't I Use Search?

Vote:
 

Hello,

I've installed the Alloy Demo Kit, installed Content Delivery API, Find, and everything's been configured to work together thanks to the documentation. I'm now able to make GET requests with Postman and my browser to see content.

What I want to do now is make calls which search for multiple pages but whenever I use search in my URL(ex: "http://localhost:xxxxx/api/episerver/v2.0/search/content?top=5") string I always get 404-Not Found.

Are there additional steps I need to complete in order to make this type of call work? Do I need to install Episerver Content Delivery Search?

#210528
Edited, Nov 26, 2019 22:38
Vote:
 

Check out Foundation. Our new starter kit that is available on github as open source. https://github.com/episerver/Foundation It has delivery api installed by default

#210534
Nov 26, 2019 20:46
gabed123 - Nov 26, 2019 21:46
Thanks but I already have the Content Delivery API installed on my Alloy starter kit
Vote:
 

Hi,

Yes, the Find search functionality within the content delivery API is in the EPiServer.ContentDeliveryApi.Search package so you'll need to install that if you haven't already.

#210544
Nov 27, 2019 12:32
Vote:
 

Thanks for the response Paul!

I installed EPiServer.ContentDeliveryApi.Search successfully and my solution is running fine but when I run at GET Request http://localhost:*****/api/episerver/v2.0/search/content?filter=ContentType/any(t:t eq 'Start Page') in Postman I still receive a 404 - Not Found error. As I mentioned before I only get the 404 when I try search URLs.

Screenshot: https://www.dropbox.com/s/y1n73hvbmjiu8gb/8934y3084.PNG?dl=0

I'm trying to achieve the same thing screenshot at the bottom of the walkthrough linked here: https://world.episerver.com/blogs/david-buo/dates/2018/11/get-started-with-content-delivery-api-2-2-0/

#210663
Edited, Dec 02, 2019 23:54
Vote:
 

Hi,

I notice from a previous version of your response that you originally hit the duplicate route issue. I'm guessing you fixed that by adding an appsetting to your config to disable mapping of attribute routing however, depending on what key you added, it may be that you disabled the wrong routing. The app setting you should use is:

<add key="episerver:contentdelivery:maphttpattributeroutes" value="false"/>

If you set "episerver:contentdeliverysearch:maphttpattributeroutes" setting to false instead, the search route would return a 404.

#210673
Dec 03, 2019 10:40
Vote:
 

Hey Paul,

Yes I fixed the duplicate issue by adding <add key="episerver:contentdeliverysearch:maphttpattributeroutes" value="false" /> originally, however when I switch that out for <add key="episerver:contentdelivery:maphttpattributeroutes" value="false" /> I'm still getting 404. Not sure what to do at this point and it isn't very clear in the documentation.

Thanks for your patience.

#210698
Dec 03, 2019 16:18
Vote:
 

Hi,

When I gave the process a try I found that, at one point I had to temporarily set optimizeCompilations to false in web.config in order for my changes to take effect like this:

<compilation debug="true" targetFramework="4.6.2" optimizeCompilations="false" />

Once everything was working correctly I switched it back to true and everything continued to work as it should.

Hope that helps.

#210700
Dec 03, 2019 16:37
Vote:
 

Thanks!

I followed the steps you've provided and I'm now getting a different response when I search for the content type page:

{"totalMatching":0,"results":null}

Is this a common issue?

Edit:

I was successfully able to get it working by re-indexing the site after following the steps you've provided. Thanks again help!

Also, I need to say that I think Episerver could do a much better job documenting this process and a lot wasn't very clear. 

#210704
Edited, Dec 03, 2019 17:28