Why I Created the API Builder Plugin for Unreal Engine

Furkan Kıyıkçı
4 min readOct 22, 2023

--

When it comes to handling API requests within Unreal Engine, I found that there were several challenges and limitations that needed to be addressed. This is what led me to create the API Builder Plugin. Let’s delve into the key reasons behind its development.

1. API Request Handling in C++

One of the primary motivations for developing the API Builder Plugin was the need for a novel approach to handling API requests in C++. The existing methods for managing and modifying predefined behaviors often proved to be cumbersome and inflexible. Here are the issues I encountered:

  • Maintenance and Modification Challenges: Existing solutions required a high degree of familiarity with midcore C++ programming, making it challenging for developers who primarily work with Blueprint scripting.
  • JSON Manipulation and System Templating Skills: Handling JSON data and creating system templates demanded specific skills that were not always readily available.
  • Strict Reliance on JSON Language: Many existing approaches were rigidly tied to JSON, limiting flexibility and adaptability.
  • Difficulty Exposing to Blueprints: Exposing these functionalities to Blueprints was non-trivial, and the most common approach was through asynchronous function callbacks, which could be complex.

2. API Request Handling with Other Plugins in Blueprints

While alternative plugins existed for handling API requests in Blueprints, they presented their own set of challenges:

  • Manageability: They often lacked a user-friendly and manageable system for typical gameplay developers.
  • Implementation Difficulty: Configuring these plugins was complicated and error-prone, making debugging a daunting task.
  • Aesthetic Concerns: The resulting Blueprint setups were not visually pleasing and could become unwieldy.
An example of getting a json data from an Endpoint using a Blueprint Exposed Function

3. A New Era for API Request Handling in Blueprints

The API Builder Plugin heralds a new era in API request handling by introducing several key features:

  • Generic JSON Serialization/Deserialization: This plugin offers the ability to handle JSON data in a generic manner, allowing users to work with user-defined and typed data structures directly in Blueprints.
  • Enhanced Readability and Maintainability: Working with the API Builder Plugin in Blueprints is not only efficient but also visually tidy and aesthetically pleasing.

4. Seeing the API Builder in Action

Let’s assume we need to parse data received from an API endpoint and convert it to a representative data structure. For simplicity, I’ll use a dummy JSON provider to retrieve a product from dummyjson.com/products/{id}. The URL responds with a product for the given ID, which in our case is 1. The server responds with this JSON:

{
"brand": "Apple",
"category": "smartphones",
"description": "An apple mobile which is nothing like apple",
"discountPercentage": 12.96,
"id": 1,
"images": [
"https://i.dummyjson.com/data/products/1/1.jpg",
"https://i.dummyjson.com/data/products/1/2.jpg",
"https://i.dummyjson.com/data/products/1/3.jpg",
"https://i.dummyjson.com/data/products/1/4.jpg",
"https://i.dummyjson.com/data/products/1/thumbnail.jpg"
],
"price": 549,
"rating": 4.69,
"stock": 94,
"thumbnail": "https://i.dummyjson.com/data/products/1/thumbnail.jpg",
"title": "iPhone 9"
}

To handle this request, we need to define a matching structure:

Matched Structure Data to Products Json
Options
An Example of Getting Products Json from web

When the request is completed, the Product Structure is filled with the received JSON data from the endpoint.

For a POST request, you need to set the option method to POST and provide a structure to represent JSON data in the body. The plugin also supports parsing JSON arrays, with specific struct naming to match the JSON object’s array container.

{“products”: [{..},{..},..}]}

Currently Json to Struct / Struct to Json Serializer supports all the needed functionality in general usage of JSON.

4. Challenges in Creating a Generic JSON Handler

The journey of creating this plugin came with its own set of challenges, which I aimed to overcome:

  • Exposure of JSONs and Structs in Blueprints: JSON data and data structures are not readily exposed in Blueprints. While there are third-party plugins in the Marketplace that attempt to address this, they often require intricate combinations of functions to extract desired values.
  • Access to User-Defined Structs in C++: It’s essential to note that user-defined structs are not directly accessible in C++. For usage in either C++ or Blueprints, you need to define these structures beforehand. Without prior knowledge of the struct type, extracting data or properties from it can be challenging.

In conclusion, the API Builder Plugin for Unreal Engine aims to streamline API request handling, making it accessible, efficient, and visually appealing in Blueprints, while addressing the shortcomings of existing solutions. This plugin seeks to empower developers with the tools they need to tackle API-related tasks with confidence and ease.

UE Marketplace — BackendTools

UE Marketplace — API Builder PRO

--

--

Furkan Kıyıkçı
0 Followers

Experienced Backaend Game Developer with a passion for innovation and problem-solving.