Creating explicit API endpoints for each table


#1

Hi all,

Just discovered DreamFactory and it looks pretty awesome (feel like I was a little late to the party!)

The generated API looks good, but I wondered if it was possible to generate an API with an endpoint explicitly generated for each table in the database? Apologies if I’ve missed something here or just plain missing the point?

Cheers

Alex.


#2

Hi @rockgoby,

The endpoints are dynamically created based on the schema. Looking at the sytanx of the calls in the API Docs tab, you can see that when you head to the _table/{table_name} endpoints you can point to any table OR view (DF treats views as tables).

Does that help answer your question?


#3

Hi Erik,

Many thanks for the response. I think I need to correct the question a little. I see we get an endpoint for each table in the schema, but this is based on a template. The API docs then provide details of this templated API (which is effectively the same for any database) but does not enumerate out for all the tables within the schema. I can see the advantages of this approach, but I was hoping to be able to create an API more in alignment with the Swagger examples, e.g. https://petstore.swagger.io/

Cheers

Alex.


#4

Hi Erik,

Many thanks for the response. I think I need to correct the question a little. I see we get an endpoint for each table in the schema, but this is based on a template. The API docs then provide details of this templated API (which is effectively the same for any database) but does not enumerate out for all the tables within the schema. I can see the advantages of this approach, but I was hoping to be able to create an API more in alignment with the Swagger examples, e.g.

PET table

post/pet
put/pet
get/pet/findByStatus
get/pet/findByTags
get/pet/{petId}
post/pet/{petId}
delete/pet/{petId}

STORE table

get/store/inventory
post/store/order
get/store/order/{orderId}
delete/store/order/{orderId}

Cheers

Alex.