Share a pre-filled action URL
Port allows you to generate links that pre-fill action inputs, making it easy to share action execution URLs with your developers.
This is particularly useful when you want to:
- Create bookmarks for commonly used actions with specific inputs.
- Share action execution links in documentation.
- Programmatically generate action links from your systems.
How it works
The action execution URL follows this structure:
https://app.getport.io/self-serve?action=ACTION_IDENTIFIER&actionInputs=ENCODED_INPUTS
ACTION_IDENTIFIERis your action's unique identifierENCODED_INPUTSis a minified version of your inputs using JSURL encoding
Generate action execution URL
To generate an action execution URL, you will need to use the JSURL library to properly encode the action inputs.
Code example (click to expand)
// Load jsurl2 library
let script = document.createElement('script');
script.src = "https://cdn.jsdelivr.net/npm/jsurl2";
document.head.appendChild(script);
script.onload = function() {
// Your action inputs
let actionInputs = {
input1: "value1",
input2: "value2"
};
// Encode the inputs
let encodedInputs = JSURL.stringify(actionInputs);
// Generate the full URL
let actionIdentifier = "your_action_id";
let url = `https://app.getport.io/self-serve?action=${actionIdentifier}&actionInputs=${encodedInputs}`;
console.log("Action URL:", url);
};
When pre-filling the entity to operate on in DAY-2 or DELETE operations, use $targetEntity as the input key, and the entity's identifier as the value.
Example
Let's say you have a "Report Bug" action with identifier report_bug that accepts the following inputs:
title: The bug titleseverity: Bug severity leveldescription: Detailed bug description
The following code will generate a link for it:
let actionInputs = {
title: "UI Performance Issue",
severity: "High",
description: "The dashboard is loading slowly when displaying more than 100 items"
};
// Using JSURL to encode
let encodedInputs = JSURL.stringify(actionInputs);
let url = `https://app.port.io/self-serve?action=report_bug&actionInputs=${encodedInputs}`;
The generated URL will lead to the action's execution form, pre-filled with the defined input values.
For complex inputs with special characters, spaces, or nested objects, using JSURL encoding is essential as it properly handles these cases while keeping the URL compact.
Interactive URL generator
To simplify the process described in this page, you can use this interactive tool to generate the finalized URL:
Use action URLs in entity properties
Action URLs can be used within entity URL properties, allowing developers to trigger actions directly from the entity page without navigating to the self-service hub.
When an entity property (including calculation properties) contains a valid action URL, clicking on it will open the action execution form in a modal on the current page.
Example: Dynamic action link in a calculation property
You can create a calculation property that generates an action URL. For example, a "Deploy Service" link:
{
"calculationProperties": {
"deployAction": {
"title": "Deploy Service",
"type": "string",
"format": "url",
"calculation": "'https://app.port.io/self-serve?action=deploy_service&actionInputs=<encoded_inputs>'"
}
}
}
Use the action inputs parameter with JSURL encoding to create personalized action URLs based on the entity's data.
Action URLs also work within array properties.
In an array of URLs, clicking on any of them will open the corresponding action form in a modal.
Limitations
- Labeled URLs are not supported: Action URLs must be plain URL strings. The labeled-url format (containing both a URL and display text) will not trigger the in-page modal behavior.
- Array consistency: When using an array of URLs, the modal behavior only works if all URLs in the array follow the action URL pattern. Mixed arrays (containing both action URLs and regular URLs) will not trigger the modal.