Search code examples
marklogicmarklogic-9marklogic-dhf

MarkLogic : Custom REST URL construction


MarkLogic Version : 9.0-6.2

I have a requirement to build end point URL for a custom REST API as shown below.

https://localhost:8011/v1/resources/customer/registration/preference

so I created folder structure as shown below

\plugins\entities\Customer\harmonize\REST\services\customer\registration

Inside 'registration' folder, I placed preference.sjs file. When I called the service, I am getting 405:Method not found error.

But if I place the same exact code (preference.sjs) under

\plugins\entities\Customer\harmonize\REST\services\ 

and use the URL https://localhost:8011/v1/resources/preference then I am getting expected results.

Any pointers on how to structure the folder to support the desired URL?


Solution

  • I don't believe that directories are supported for REST API Resource Service Extensions.

    You could use a delimiter, such as - in the extensionName instead of directories, in order to organize the extensions and ensure that they are grouped when sorted:

    \plugins\entities\Customer\harmonize\REST\services\customer-registration-preferences.sjs