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_IDENTIFIER
is your action's unique identifierENCODED_INPUTS
is 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);
};
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.getport.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: