Create a .raml file with several enpoints


#1

Hello , I am new with .RAML. I would like to know if there is a way of creating a .raml file with different endpoints. Any idea of how to do that?
Thanks
Gorka


#2

Do you mean different baseUri paths? If so, that isnt possible that I know of, but you probably could use longer resource URL names and a simple baseUri… maybe like:

http://mysite.com

/prod1/api/someresource:
get:

/prod2/api/someresource:
get:

Although, I would argue that you are not taking advantage of RAMLs modular capabilities very efficiently with this approach. It sounds like you are trying to create an uber API for various API surfaces in one file? If so, why would you want to do this? Is it so you can render say RAML2HTML for the entire set of API surfaces so they are all together?


#3

I mean , in case you want to join , for example 300 endpoints in a .raml file. How could you do that ? As you say is it imposible to do it. Is it possible to do it with a raml2html. Is there any maven or eclipse plugin which would generate the api documentation of a .raml file ?
Thanks
Gorka


#4

Ah, ok… there was some discussion on this some time back and I think at that time, you would have to write some code that combined the files in some manner. With RAML 1.0, you could create a root .raml file that then includes different Library raml files, each of those being their own API surface. However, a Library wouldnt have their own baseUri and title and such in it, so you would still need some way via code at this point to identify each API surface as individual APIs that could stand alone. RAML 1.0 is very modular though, so I suspect there is some way I havent yet discovered that could be used to do something close to what you want.

Let me make sure, again, though, that you are suggesting individual stand alone APIs (in their own .raml files), that you then want to combine, sort of like how a company with many products will have different deployments/packaging, but they all fit under the umbrella of the one company… is that right? Or, are you just looking for a way to break up tons of endpoints for a single API surface and then combine them again? If it is the latter, than RAML 1.0 will allow you to build libraries and other leafs (e.g. resource Types, annotations, etc) in to separate files, then you can import them in a root document. When parsed, it would all appear to the parser as one API surface.


#5

Hello , I need thousands of endPoints.
Thanks
Gorka


#6

Alright, first I am not quite sure I understand… 1000s of endpoints? Why would any API need even 10s of endpoints much less 1000s? Can you elaborate a bit more? Any API that has lots of endpoints typically is difficult to use or work with. I suspect this is a different scenario from some of your other posts as well, but could use a little more details. Feel free to PM me if it is something you dont wish to discuss in the open.


#7

Maybe @Gorka_Sanz_Monllor meant thousands of open connections when the API is being used…