Define Asynchronous API Method


#1

Is is possible to specify an API method as asynchronous or synchronous with RAML? I do not see anything about synchronous/asynchronous calls in the spec sheet, but I can’t imagine it was left out. I have several calls in my API that are asynchronous, so denoting which are which is pretty critical. I suppose it could be done in the description or something, but that seems tacky.

Any thoughts?


#2

I can’t remember to have seen it somewhere. My first guess would be also to use the description section or traits, but both seems to be not the best option. What do you think would be something suitable? :slight_smile:


#3

I suppose using the description would be the next best option, in lieu of a dedicated field or something like that.
Thank you :slight_smile:


#4

I’ve added support for asynchronous resources to the JAX-RS generator and it’s based on a trait.

Basically, you create a trait to flag asynchronous methods and tell the generator what trait it is. It then generates JAX-RS 2.0 async methods.


#5

Can you describe this in more detail?

  • What do you mean by sync/async? You mean “Fire and forget”?
  • Why do you want to capture this distinction? for Documentation purposes? To generate different SDKs?

#6

Just google Asynchronous and Synchronous web services to see the difference…Nobody said anything about “Fire and Forget,” so I’m not sure what you mean there. I want to capture the distinction because it means an API call will behave differently depending on whether the call is async or not.