简体   繁体   中英

Loopback - get list of API endpoints via REST

Loopback has nice documentation which you can view at

http://<your-domain>:<your-port>/explorer

I want to write some tests for our server, and at the very least do a GET request for each of the endpoints that should be public and available over REST.

Loopback explorer clearly has this information somewhere - is there a way to get a list of endpoints programmatically?

I just want something like this list:

PATCH /ServicecontractViews 
GET /ServicecontractViews 
PUT /ServicecontractViews 
POST /ServicecontractViews 
PATCH /ServicecontractViews/{id} 
GET /ServicecontractViews/{id}
HEAD /ServicecontractViews/{id}
GET /Notes/{id} 
HEAD /Notes/{id}
PUT /Notes/{id}
DELETE /Notes/{id}
GET /Notes/{id}/exists 

is it possible to get this information programmatically (while the server is live)?

The LoopBack explorer uses Swagger JSON to generate the UI you see.

If you watch the XHR requests using your browser debugger, you can grab the direct URL to the raw Swagger. This data should contain what you need, though not in quite as concise a format as you probably want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM