# Mashup API

**URL:** <https://forums.pega.com/t/mashup-api/8115>\
**Category:** Knowledge Share\
**Tags:** 24, other-industry, constellation, lead-system-architect\
**Created:** [August 22, 2024, 6:39am UTC](https://forums.pega.com/t/mashup-api/8115 "2024-08-22T06:39:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KamilJaneczek](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/kamiljaneczek/32/23339_2.png) [@KamilJaneczek](https://forums.pega.com/u/KamilJaneczek)\
**Post date:** [August 22, 2024, 6:39am UTC](https://forums.pega.com/t/mashup-api/8115/1 "2024-08-22T06:39:45Z")

</div>

![banner.png](https://pega1.discourse-cdn.com/pega/original/1X/b5de5bc925d9cd8216ffc325402555cc6b7033c4.png)

This article is part of series of articles named **Constellation Flexible UI**. Please check table of contents: [https://support.pega.com/discussion/constellation-flexible-ui](https://support.pega.com/discussion/constellation-flexible-ui)

 ![disclaimer.png](https://pega1.discourse-cdn.com/pega/original/2X/2/28397d0895947b0ce03c195ad13af16e75b50a44.png)

In previous article we saw basic way pf interacting with Pega using one of the available API, namely Data API. All the APIs are for our disposal, but there is one very special API. Mashup API deserves some more description and our attention. The reason is that Mashup API gives a lot of benefits when used. In previous article we mentioned some of the APIs in ConstellationJS.

The allow for some specific task to be performed like:

- fetch data from data page
- operate on assignments
- manages containers
- interacts with Redux state

Mashup gives the ability to embed or “mashup” Pega Constellation applications or components within external web applications using the Constellation SDKs. This is high level abstractions that allows to render Pega UI in external portal.

Mashup API is a core API. One that is widely used, the same in our mini series. Following methods are available on MashupAPI class:

 ![ap docs.jpg](https://pega1.discourse-cdn.com/pega/original/2X/0/076ea1aa33365d334e1553dc819a99f66733a496.jpeg)

**Mashup API is one of the reasons I believe using SDKs is so powerful and time saving.** After lecture of this and next article you will be in a position to judge yourself.

In current article we will follow with implementation of **createCase** method. In one of next chapters we will cover **openPage** method that allows us to specified open page, Pega **Landing page** and embed it into external portal. This is pretty powerful pattern, and with combination with Custom DX Components allows us create pretty much anything that we need and want! We explore the details and compare both available methods:

- get data and leave rendering to fronted - this is what we implemented on Products page
- open Pega page that lists some records - this approach we used to implement **Featured Products** widget on main page

# Create Incident case

Before that let’s go back to **createCase** method on MashupAPI class. As the name suggests this method creates a Pega case instance. But it is a lot more, it is not just a backend call to create resource and bring status of performed operation.

If you wish to just to perform create action it is possible in two ways:

- raw DX API call

 ![postman.png](https://pega1.discourse-cdn.com/pega/original/2X/d/d64631a98c85e145697ffd31b028adc51ae02f4a.png)

but we are not here to learn about ConstellationJS and SDKs to send raw REST API calls 🙂

- second option is to use raw HTTP request toward DX API endpoint. We will see later in this article how we can utilize this capability

In example that we will use on **Support** page we will use **createCase** function available on **MashupAPI** to render an **Incident** Case Type. Incident Case Type is main case type in Tell Us More. Please refer to document named Tell Us More (attached to this post) - application overview to get more details about application, case type and their design and implementation.

From six stages in Incident case type five are done by back office and only the first one is meant to be performed by the client on Sweet life home page. This is the part the we will cover with SDKs.

 ![case.png](https://pega1.discourse-cdn.com/pega/original/2X/1/1880db8f4926e1ebc6d435c6be9ed7d2c6a611a1.png)

All work after first stage is back office part of the flow that will be performed by Sweet Life support team. Support team will use standard out of the box Constellation portal that is most suited for back office work. SDKs as of now do not support all of the back office functionalities eg. Insights. Anyhow SDKs are better positioned to create rich and complex UIs, exactly as in Web Self Service portals. This is in fact typical pattern:

- use SDKs for WSS portal for case ingestion
- process case in a back office with ootb Constellation portal

Having all the heavy lifting done in previous articles running mashup to create an Incident case is just couple of lines. In our example case creation happens on a button click.

 ![support page.png](https://pega1.discourse-cdn.com/pega/original/2X/e/e228839d9f49702070fa2a6b3331e2089d492861.png)

Clicking on a Create Incident button triggers **handleCreateCase** function.

 ![handlecreatecase.png](https://pega1.discourse-cdn.com/pega/original/2X/0/0c9686fdbaddd5f2719c41572a532ec5b6511581.png)

Please refer to github repo for more details: [https://github.com/kamiljaneczek/Sweet-Life-Pega](https://github.com/kamiljaneczek/Sweet-Life-Pega)

We use **PubSubUtils** to know when assignment is finished or closed to hide Pega UI. We don want to display out out the box assignment widget inside external portal. Additionally, make sure that you got div with **pega-root** in your DOM. Pega will insert there mashup code.

 ![code.png](https://pega1.discourse-cdn.com/pega/original/2X/c/cb5fe41f3c1ef3d9d04912d272570ebfb97f873d.png)

The code in **useEffect** is similar as before.

One drawback of this solution is that new case is created each time user open the Contact page. We would need to implement a Job in Pega to clean abandoned Inquiry cases. Not a big issue but let’s see how we can avoid it with second approach.

We already mentioned couple of times that mashups are great as otherwise we would need to to a lot of activities manually. One of the approach to manually interact with Pega and use directly DX API call. While this is possible it take a lot of manual work, and I believe this is viable solution when creating a case, but might be problematic to use this solution for a complex case processing tull resolution. Keep this in mind but let’s see how we can achieve it.

 ![contact.png](https://pega1.discourse-cdn.com/pega/original/1X/1a5c353092d72e590fdf8f1a617194e8384d6cce.png)

We can trigger **DX API** call on a button click.

 ![kamil janeczek.png](https://pega1.discourse-cdn.com/pega/original/2X/5/56fdf0869fe30e2bc8e2076b1d752bcfd97f10e0.png)

Info: code below includes authentication with **customBearer** flow, I will describe it in one of next articles.

The advantage here is that we don’t have cases created each time Contact page is opened. This solution is great choice when from a front end portal we want to create case from a single screen, without a cased being processed. Otherwise we would need to handle this cases processing on our own, which is complex. Mashup API discussed in this article hides this complexity.

---

<div class="post-metadata">

**Author:** ![KamilJaneczek](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/kamiljaneczek/32/23339_2.png) [@KamilJaneczek](https://forums.pega.com/u/KamilJaneczek)\
**Post date:** [April 16, 2026, 6:42am UTC](https://forums.pega.com/t/mashup-api/8115/2 "2026-04-16T06:42:27Z")

</div>

Please note that content of this post is not being further updated and refers to pega23-branch on [GitHub - kamiljaneczek/Sweet-Life-Pega at pega23-branch · GitHub](https://github.com/kamiljaneczek/Sweet-Life-Pega/tree/pega23-branch)

Updated version of repo for Infinity 25 is in pega25/react-rotuer branch: [GitHub - kamiljaneczek/Sweet-Life-Pega at pega25/react-rotuer · GitHub](https://github.com/kamiljaneczek/Sweet-Life-Pega/tree/pega25/react-rotuer)

Checkout more here:[Migrating Sweet Life from Pega Constellation SDK 23 to 25](https://forums.pega.com/t/migrating-sweet-life-from-pega-constellation-sdk-23-to-25/10879)
