Recently, the number of people developing backends and creating services with SyncTree has been increasing. Today, we have collected 7questions that many people may be curious about too.
Q1. I want to connect SyncTree with external services (JS, Flutter, etc.). How can I implement this?
A. If you first understand the basic SyncTree external service integration method, it will be easier to apply it to linking with various external services.
SyncTree takes a method of linking back-end development output created using the block coding method with external services by calling it in 'API format (Method, End-point, Parameter).' If you distribute the backend development output created with SyncTree through the SyncTree 'API Portal', you can check 'Method' and 'End-point' in the 'API Documentation', and most development frameworks use 'https / restful' API communication. is supported, so you can connect according to the communication method guide for each desired service.
For example, in the case of Flutter, API communication is possible using the http module, so try to connect according to the 'Flutter http module' guide!
Q2. Can I connect SyncTree with an external DB (AWS S3, MySQL, etc.)?
A. Yes, connect to the Storage Block by registering connection information for a total of 7 external DBs (AWS S3, Dynamo DB, MSSQL, MySQL, Oracle, PostgreSQL, Redis) created in advance in the 'SyncTree STUDIO' > 'Storage' menu. You can use it. Please refer to the MySQL integration example below!
See the manual for MySQL Sample DB Integration
Q3. How can we solve the CORS issue?
A. Unfortunately, SyncTree does not support CORS resolution through 'Access-Control-Allow-Origin' for security reasons. However, please note that this problem can be solved through the proxy setting method provided by each development language.
Q4. Can I add external code such as Java or Python to SyncTree?
A. Unfortunately, SyncTree does not support the function of importing native development languages. Instead, you can distribute the source code created in Python and then use the 'Transfer' block to call the API Endpoint.
See the manual for calling Transfer External API
Q5. When receiving results from an external API, is there a way to receive only the desired value?
A. Yes, the method is the same for both Request and Response parameters. Just remember this: Scrape data with the ‘Fetch’ block and find it with the ‘Get hashmap’ block! The 'Fetch + Get Hashmap' block combination is a pattern frequently used in SyncTree, so it will be of great help if you learn exactly how to use it through the manual below.
1. See the manual for Fetch block
2. See the manual for Get Hashmap block
Q6. How do I use the response value from the previous API as the next request value?
A. It is possible through API mashup to store the first API result in a variable and use it as a request parameter for the second API. Please refer to the video below for an example of an API mashup using a total of 3 blocks: 'Open AI - ChatGPT' block, 'Google Map Location Information Check' block, and 'Open-Meteo - Weather' block.
Q7. How can I write 'if else / else if' code that processes things according to whether a condition is satisfied?
A. By combining the 'Util' > 'Array Contains Key' block with the Expression of the 'IF' block, it can be used as a branch processing condition.