Creating a Custom Glue API in Spryker

Blog
Spread the love

Spryker’s Glue API is a powerful tool for exposing data to frontend applications, mobile apps, and third-party integrations. In this guide, we will walk through the process of creating a custom frontend Glue API in Spryker.

What is Spryker’s Glue API?

Spryker’s Glue API follows RESTful principles and provides scalable API solutions. The frontend Glue API allows data exposure that can be consumed by web or mobile frontends without requiring backend authentication.

Creating a Custom Glue API Module

To create a custom Glue API, follow these steps:

Step 1: Create a New Module

Navigate to the Spryker project’s src/Pyz/Glue directory and create a new module. Let’s name it CustomApi:

Step 2: Define Your Glue API Plugin

Create a new CustomApiResourcePlugin.php inside CustomApi/Plugin/GlueApplication/:

Step 3: Implement the Factory

Create a CustomApiFactory.php inside CustomApi:

Step 4: Implement the CustomApiDependencyProvider.php

Create a CustomApiDependencyProvider.php:

Step 5: Implement the Controller

CustomApiResourceController.php:

Step 6: Implement the Processor

CustomApiProcessor.php:

Step 7: Register the Plugin

To register the plugin, modify GlueApplicationDependencyProvider.php:

Step 8: Define the Transfer Object

Create custom_api.transfer.xml inside src/Pyz/Shared/CustomApi/Transfer/:

Step 9: Generate Transfer Objects and Clear Cache

Run the following command to clear caches:

img

Now, start your Spryker application and test the API using a tool like Postman or CURL:

img

GEThttp://glue.eu.spryker.local/custom-api

You should receive a JSON response:

Step 10: Removing the Access Token Requirement

By default, Spryker APIs require authentication. To make this API public, update the plugin configuration:

Modify CustomApiResourcePlugin.php:

Conclusion

In this guide, we created a custom frontend Glue API in Spryker, registered it, and made it accessible without an access token. This API can be extended to return dynamic data from the database or other sources.

bluethinkinc_blog

bluethinkinc_blog

2025-03-12

0

Leave a Reply

Your email address will not be published. Required fields are marked *

Find More Blogs

Creating a Custom Glue API in Spryker

Spread the love Spryker’s Glue API is a powerful tool

Get AI Generated 360-Degree View of Account Summary in Dynamics 365 Sales

Spread the love Navigating the demanding landscape of sales

Enhancing Productivity with Dynamics 365: The Power of Session Restore

Spread the love Enhancing Productivity with Dynamics 365:

Salesforce Admin

Spread the love In our last blog, we discussed common

Unlocking AI with Spring Boot: Real-World Use Cases and Solutions

Spread the love Artificial Intelligence (AI) has moved from

Enhancing Performance with Reactive Java: A Beginner-Friendly Guide

Spread the love In today’s fast-paced software

Integrating Azure Function with Dynamics 365

Spread the love Signup on azure portal and make sure to

How to Create a Power Apps Component Framework (PCF) with React

Spread the love If youʼve been looking to supercharge your

Customize lead qualification for a seamless experience

Spread the love When the 2024 Release Wave 2 was launched,

Create a Custom Console Command in Spryker

Spread the love In Spryker, developers can create custom

bluethinkinc Blogs