Can i create unify API for different platforms?

Options
Hi all!

I want to create a service which will provide unified API for different platforms and I have some questions:
• Can I create my own URL for API calls? For example, I want use https://mysite-name.com/api:fjF6GKKx/methon, not https://xrrck-inu6-aersl.f2.xano.io 
• What should I pay attention to when creating such a service? Are there any best practices for combining different APIs into one? Should it be a single call that, using conditions, calls the functions of the desired platform, or is it something else?

Thanks!

Comments

  • Felipe Letelier
    Options
    Hi there! Regarding your first question, I'm pretty sure that Xano allows you to use your own domain to "customize" your endpoint's urls (link to docs).

    About your second question, if I understood it correctly, it is totally doable and one of the great things about Xano. I created an API that merges data from Xano's DB and a third party API, to keep it simple I created a standard response schema which I completed with the data of the items I'm pulling from my DB and the API. 

    I think the most relevant feature for us is using the cache to store the data based on some parameters/IPs, this will help you with:
    • Total response time: when fetching data from external sources, the response time of each API adds up and could become too long to wait. Caching your responses using standardized  parameters will help you to load your data at godlike speed in your frontend😜
    • Decrease costs of external providers: In our case the external data we are fetching through the API is paid, and the provider charges us for each call. By caching your responses you avoid doing the very same call over and over again and you don't get charged for doing redundant calls.

    The only catch of using the cache in the lower plan, is that you don't have much control over how and when to store the data, but if you are paying the Scale plan, then you get all the "Cache features" available.

    A problem we encountered, is that when fetching items from different data sources, some times generates unexpected behaviours, for instance we sort items by price, so we fetch the products from the APIs requesting to be sorted by it, but one provider has a lot of cheap items, while another provider has a lot of expensive items, so when using pagination you may see cheaper items in the second list than the last items of your first page (hope it makes sense). At the end we didn't prioritize this, we just sorted the resulting array in Xano and displayed the next page even if the prices weren't totally coherent to the selected sorting order. 

    Also, consider that some external API providers do not always return the same schema in their response, and Xano is very sensitive to that, it may break your endpoint if Xano fails to find the path to the data you want to recover from an API response, so you may have to use some conditionals to check if the path exists beforehand. In my case I created a snippet to address this issue as it was very common. 

    Hope this helps!
  • Evgeny Sporykhin
    Options
     Thanks 🙂