Best practices designing sandbox for REST api - rest

We are developing some REST api's for internal use. To test these microservices we are toying with the idea that every service has a sandbox mode so we can do integration tests that are as close as possible to the real deal.
To see if this path is worth trying we are looking for documentation / best practices on how to manage this sandbox and how to implement this internally. When we look for the keywords Sandbox, REST API and Best Practices we only find how to implement as consumer of existing sandboxes.
So does anyone have some documentation / links in how to tackle this problem and what the pro's and con's are of the different ways?
Kr,
Thomas

I'd say there are two ways to proceed:
Basic: keep a separate sandbox instance of a service. You always deploy a new code to this instance first and run automated/manual tests to verify if everything works fine. A datastore could be a snapshot from the production data or artificial testing data. I would rather we have a "Snapshot" but it depends whether it is applicable in your particular case (privacy etc.)
Advanced: I spied this technique on Facebook Marketing API. This API provides an interface to set up and launch advertising campaigns. They didn't provide a sandbox api for testing purposes (at least last year when the system I was working on had been integrating with Facebook). However if you use a keyword "test" in a name of a campaign or an adset (key entities in the ad world) they would never launch and spend your money. You can try extend this concept on your particular domain and run tests on (or very close to) your production
Hope this helps

Related

Publishing a Headless ecommerce. Which Costs i need to consider?

I'm developing an ecommerce website.
It's for a "ground-based" clothing store that is used to sells only via third party platform.
And now want a own website.
I started with Wordpress+Woocommerce.
Then i tried a ZeitNow+Next+Graphql+React version.
It connects itself to Wordpress+Woocomerce database via GraphQL Queries.
It uses ZeitNow to avoid implementing a real Node+Express server on my machine.
Which path to choose to complete the website and publish it ? My doubts are related mainly to COSTS.
If i choose the classic WP+Woocommerce way i need :
0-20 EUR /year for Domain Name.
120EUR / year approximately for a classic web server (with PHP+MySQL) hosting plan where to place the Wordpress+Woocommerce.
If i'd like to choose second option, based on what i know actually i need :
0-20 EUR /year for Domain Name.
120EUR / year approximately for a classic web server (with PHP+MySQL) hosting plan where to place the Wordpress+Woocommerce "head" part of my project, .
0EUR /year for serveless ZeitNow (free plan).
But where i need to place the "App" (ZeitNow+Next+GraphQl+React)?
An other Web server (with Node) ?
So an other 120EUR/ year plan ?
Or beacuse it's serverless i can only "deploy" to zeitNow and only link my domain to ZeitNow?
Its not clear to me.
I found on the web things like "Netifly", "Firebase", "Heroku", "AWS" ...
Are they all equivalent to Zeit Now?
I would like to publish a website with benefits of WooCommerce CMS system.
Like adding products, managing stocks, handling discounts plans, access to PayPal and Stripe payment methods integrations (i don't trust my self enough to build integration on my own due to security risks).
I wolud like also the keep benefits of using React for front End like performance (at least perceived) for Final User, or no need of Ajax request to update Cart and Wishlist.
And what about calculating if my project needs a "payed plan" of ZeitNow/Netifly/AWS to manage the request? How i can calculate them?
Sorry for the high number of question, but for me, understand the co-existence of these things is overwhelming!
Thanks.
You will always need a paid plan on any platform if you are running a for-profit endeavor.
You may need ZEIT Now to host your frontend and another server for the GraphQL API unless you really want to go DevOps-less by using serverless functions.
Here are very relevant pages for calculating costs:
ZEIT Now pricing page. Notice the "Serverless Execution" and also "BandWidth" prices.
Netlify.
AWS.
In the end, you will need to deploy a "Proof-of-Concept" and be really careful with the metrics. It is impossible to pinpoint an exact number with a custom solution because depending on your implementation, it can be more or less expensive to make API calls. Solutions like Shopify may be the best approach for your type of app. I only recommend that you develop your own stack if you want to customize, scale, and prepare the base for a team of developers later.
Disclaimer: I work for ZEIT at the moment.

Dynamically Change API Environments Google Rollout Track

I'm developing an Ionic(3 / 4)(Angular 4 - 7)-Cordova / Capacitor Cross Platform Application(s). I'm interested in switching API env based on the current rollout track in the Google Play Store. For example, once an application has been successfully tested and recommended to continue staging/production. I would like to have the API env dynamically changed (e.g., using a different URI domain to connect to REST API ) dependent on the Google Play Store Track.
I'm aware that I can use Google Developer Play Store API to identify / list versions and available tracks yet, I'm unaware if there's already an implementation or solution. I'm perfectly willing to design a solution though, I figure I find out if it's been done already rather than reinvent the wheel.
I'm hoping to implement a solution either to the REST API BACKEND or in the ionic framework layer rather than an integration at the native layer for scalability per-project. The purpose of doing this would enable CI rather than rebuilding the project and change the API URI domain for every environment. Any assistance in this matter would be greatly appreciated.
So, if anyone's interested. The approach highlighted above is possible, couldn't get an answer so I just created something. Using Google Play Developer API. The process flow is as follows:
[]
For now it's a working prototype perhaps its not very efficient; I suppose it can be improved if the request was issued from a single server, or microservice. Though, I wanted to make the code recyclable and it's isolated from both the mobile application & Node Server.
If you are interested in learning more or would like to work on project. Please feel free to contact me.

What is the standard way to implement an API sandbox?

so it occurred to me that it would be helpful in the development of my backend to have a managed sandbox, like a development environment without having to set up a separate database. To be more specific I'm using Postgresql and Node.js, but I doubt that makes a difference.
So my question is, how do services such as PayPal commonly implement a "sandbox" for developers who use their API to play with that is separate from their real data? In my case all that I want is a database sandbox that operates separately from the main database for the backend developers. My first idea on this is to tag every row with their specific sandbox or production id, but that seems inefficient. Is there another way to implement this idea?

UCMA vs UCWA - User vs Application Endpoint

I need to develop a chatbot with these properties:
Platform - Skype for Business On-Premise
Function - Replies to user queries by looking in various knowledgebases (Multiple Platforms - Databases, Web APIs, etc.)
Basic textual conversation to begin with and will gradually evolve to send attachments
No calls/videos, just chat
Will be hosted on an external server with organisation VPN
A simple sip will be created for the chatbot which can be pinged by any user. I should be able to get this through to our IT dept.
Limited time for development
Scalability is an essential requirement but the organisation is fairly new to this, so they might be patient and allow me to make mistakes
My research has led me to these possible approaches:
SfB SDK - I have rejected this approach because it requires the client to be running at all times and doesn't seem to be scalable
UCMA with Application Endpoint - Haven't rejected this approach, but seems like I'll not go ahead with this because creation of Application Platforms seems tedious and requires me to make a lot of SfB server related IT requests
UCMA with User Endpoint - Great affinity towards this. I have experimented Tom Morgan's (thoughtstuff.co.uk) stuff and this seems like something I can start off right away
UCWA with Application Endpoint - Rejected this approach, because UCWA (from my research) appears unsuitable for On-premise and the setup also seems time consuming
UCWA with User Endpoint - Haven't rejected this approach, but I'm not sure if the Web API way is really a good approach for On-premise platform
I'd like to ask how am I doing so far, but that seems too vague
What would you suggest is a good way to achieve this?
Also, can someone be patient enough to reply the drawbacks and advantages of each approach for my use case. I'd like to make an informed decision and not reject any approach, just because of a misunderstood overhead
I have been asking around in my organisation and other circles.
And since I am not receiving any quick responses, I'll keep adding what I have learnt.
This way a person in the dev community will have a log of how I went with this.
UCWA is better suited for S4B online (compared to on premise) and is generally used by people who are comfortable with RESTful and have low familiarity with .NET development
UCMA is apparently THE WAY to go and for any on-premise bot requirements, preferably with an application endpoint.
So for our development, we are starting with UCMA user endpoint so that we can deliver a basic start as a version-one
And meanwhile we shall also get in touch with the IT department and Lync administrators for creation of Application Endpoints
Once we have this the same functionality that we had with the user endpoint will be copied over to the Application Endpoint version
Keep watching this space for further updates

How to perform load test on rails based RESTful API?

this might be wrong to ask here but Can anyone suggest me a tool to test a rails based RESTful API? I need to perform load or stress test on this API and also i should be able to write script i need. Basically what i need is a load test tool to test a rails based REST API with script.
P.S.: it should be freeware also.
You can use AgileLoad to load test a RESTful API. It is free for scripting and small test, but have a license to be paid for more than 50 concurent users I think. The support team is quite proactive and can help you with advanced scripting features. They have also some tutorials and how to's available on their website.