Behrooz
Behrooz

Reputation: 243

Changing default base URL of Sitecore ServiceApiController, Is it possible?

when we implement SitecoreApiController, for each action method we make using Sitecore.Services.Core.ServicesController("namespace") attribute, we get a url like this:

/sitecore/api/ssc/{namespace}/{controller}/{id}/{action}

I wonder if we could change this default pattern, somehow in config files. I particularly interested in /sitecore/api/ part, because sometimes in the sense of security concerns, certain clients don't like to reveal that much about CMS platform behind the scene. Sometimes they even ask us to hide anything in HTTP header that tells about Microsoft ASP.NET explicitly.

Is this possible here?

Edit

this link shows a way to customize it using pipelines but I wonder if we could change the base url just through config files without needing a custom pipeline

Upvotes: 1

Views: 746

Answers (1)

Søren Kruse
Søren Kruse

Reputation: 1170

I had a look at it, and I think I found out how - although I haven't tested it.

It looks for a setting named Sitecore.Services.RouteBase and if it can't find it, it uses sitecore/api/ssc/ as the default value.

You should be able to change it with a config patch like this in the App_Config/Include folder:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      <setting name="Sitecore.Services.RouteBase" value="custom/api/" />
    </settings>
  </sitecore>
</configuration>

Upvotes: 1

Related Questions