Page History
...
As a way of embracing the awesomeness and convenience of our new enhanced BASIC+ syntax, we've added a new statement: GoToAPI. This effectively eliminates maintaining strings of support services and the long and complicate complicated Case statements that were required to route each HTTP method and endpoint combination to an appropriate GoSub label. For example:Check it out!
Code Block | ||
---|---|---|
| ||
GoToAPI else // The specific resource endpoint doesn't have a API handler yet. HTTP_Services('SetResponseStatus', 204, 'This is a valid endpoint but a web API handler has not yet been created.') end Return Response OR '' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Endpoint Handlers //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// API Contacts.POST HTTP_Resource_Services('PostDatabaseItem', 'CONTACTS', FullEndpointURL) end api API contacts.ID.PATCH KeyID = EndpointSegment HTTP_Resource_Services('PatchDatabaseItem', 'CONTACTS', FullEndpointURL, KeyID) end api API Contacts.ID.PUT KeyID = EndpointSegment HTTP_Resource_Services('PutDatabaseItem', 'CONTACTS', FullEndpointURL, KeyID) end api API Contacts.ID.DELETE KeyID = EndpointSegment HTTP_Resource_Services('DeleteDatabaseItem', 'CONTACTS', KeyID) end api |
Due to the new syntax and the desire to maintain backwards compatibility with the legacy service code, the old format of HTTP_{Resource}_Services is now replaced with {Resource}_API.
...