2

I created REST API mock using RAML tool. How can I return in my JSON object response hypermedia links with absolute paths?
Is there a way to include baseUri into my sample JSON object in order to create absolute path?

Right now I have relative path "/users/ff33c2a1-b877-4415-9e62-115b8239c787" in my JSON object:

{
"name": "John Smith",
"email": "john.smith@sample.com",
"status": "pending",
"_links": [
  {
    "rel": "self",
    "href": "/users/ff33c2a1-b877-4415-9e62-115b8239c787"
  }
]}

And actually I wanna have absolute path where root is taken from my baseUri value.

E.g. path should be something like "http://mocksvc.mulesoft.com/mocks/a2683439-a5dc-409c-801a-c771042970fb/mocks/31e46658-b4ce-4f40-cc91-c4fd50f7a2d8/v1/users/ff33c2a1-b877-4415-9e62-115b8239c787"

I tried using something like:

"href": "{baseUri}/users/ff33c2a1-b877-4415-9e62-115b8239c787"

or without quotes

"href": {baseUri}/users/ff33c2a1-b877-4415-9e62-115b8239c787

but none of the above worked.

I am using RAML 0.8.

David Dossot
  • 33,403
  • 4
  • 38
  • 72
Saša
  • 653
  • 1
  • 5
  • 17

0 Answers0