Execute a SaaS selection intent
Validate the SaaS selection of an onboarding: opens one SAAS_PROVISIONING task per app in apps under the onboarding ticket, started now, then completes the “Choose apps” task (type SAAS_SELECTION). With a future scheduleDate, the account tasks wait for that date: on the new tasks interaction model, the selection is saved (selectedApps, executedAt stays null) and the task itself turns SCHEDULED, with no account task yet; call again to replace the selection or the date, or without scheduleDate to open them now. At the date, Primo opens the account tasks of the selection saved last and completes the task. Elsewhere, the account tasks open at once, SCHEDULED until that date. This is the only way to complete a SAAS_SELECTION task: updateTaskStatus refuses it with TaskLockedByTypeError naming this operation. Start apps from selectedApps of getSaasSelectionIntent when not empty, else proposedApps, taking each saasId from there or from getSaas: a saasId that is not a SaaS of the company, an app the onboarding ticket already has an account task for, the email provider and an app that creates its accounts at first login get no task, without a refusal; an empty apps opens none. To add one app to an onboarding without this task, use createSaasProvisioningIntent. Safe to retry: a selection validated earlier answers outcome: ALREADY_EXECUTED and opens nothing again. A personalEmail another employee already holds is not saved. Refused with INVALID_SAAS_SELECTION (a saasId that is not an id, or a recipient without an email), TICKET_CLOSED (the task was cancelled), NO_EMAIL_ADDRESS (no address to create the new accounts with), EXECUTION_IN_PROGRESS, INTENT_NOT_FOUND.
curl --request POST \
--url https://api.getprimo.com/saas-selection-intents/{intentId}/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apps": [
{
"saasId": "<string>",
"groups": [
{
"name": "<string>",
"id": "<string>"
}
],
"roles": [
{
"name": "<string>",
"id": "<string>"
}
],
"licenses": [
{
"name": "<string>",
"id": "<string>"
}
],
"organizationUnits": [
{
"name": "<string>",
"id": "<string>"
}
],
"credentialsRecipient": {
"email": "jsmith@example.com"
}
}
],
"scheduleDate": "2023-11-07T05:31:56Z",
"personalEmail": "jsmith@example.com"
}
'import requests
url = "https://api.getprimo.com/saas-selection-intents/{intentId}/execute"
payload = {
"apps": [
{
"saasId": "<string>",
"groups": [
{
"name": "<string>",
"id": "<string>"
}
],
"roles": [
{
"name": "<string>",
"id": "<string>"
}
],
"licenses": [
{
"name": "<string>",
"id": "<string>"
}
],
"organizationUnits": [
{
"name": "<string>",
"id": "<string>"
}
],
"credentialsRecipient": { "email": "jsmith@example.com" }
}
],
"scheduleDate": "2023-11-07T05:31:56Z",
"personalEmail": "jsmith@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
apps: [
{
saasId: '<string>',
groups: [{name: '<string>', id: '<string>'}],
roles: [{name: '<string>', id: '<string>'}],
licenses: [{name: '<string>', id: '<string>'}],
organizationUnits: [{name: '<string>', id: '<string>'}],
credentialsRecipient: {email: 'jsmith@example.com'}
}
],
scheduleDate: '2023-11-07T05:31:56Z',
personalEmail: 'jsmith@example.com'
})
};
fetch('https://api.getprimo.com/saas-selection-intents/{intentId}/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getprimo.com/saas-selection-intents/{intentId}/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apps' => [
[
'saasId' => '<string>',
'groups' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'roles' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'licenses' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'organizationUnits' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'credentialsRecipient' => [
'email' => 'jsmith@example.com'
]
]
],
'scheduleDate' => '2023-11-07T05:31:56Z',
'personalEmail' => 'jsmith@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getprimo.com/saas-selection-intents/{intentId}/execute"
payload := strings.NewReader("{\n \"apps\": [\n {\n \"saasId\": \"<string>\",\n \"groups\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"licenses\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"organizationUnits\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"credentialsRecipient\": {\n \"email\": \"jsmith@example.com\"\n }\n }\n ],\n \"scheduleDate\": \"2023-11-07T05:31:56Z\",\n \"personalEmail\": \"jsmith@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getprimo.com/saas-selection-intents/{intentId}/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apps\": [\n {\n \"saasId\": \"<string>\",\n \"groups\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"licenses\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"organizationUnits\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"credentialsRecipient\": {\n \"email\": \"jsmith@example.com\"\n }\n }\n ],\n \"scheduleDate\": \"2023-11-07T05:31:56Z\",\n \"personalEmail\": \"jsmith@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getprimo.com/saas-selection-intents/{intentId}/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apps\": [\n {\n \"saasId\": \"<string>\",\n \"groups\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"licenses\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"organizationUnits\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"credentialsRecipient\": {\n \"email\": \"jsmith@example.com\"\n }\n }\n ],\n \"scheduleDate\": \"2023-11-07T05:31:56Z\",\n \"personalEmail\": \"jsmith@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"outcome": "EXECUTED",
"intent": {
"id": "<string>",
"taskId": "<string>",
"ticketId": "<string>",
"employeeId": "<string>",
"proposedApps": [
{
"saasId": "<string>",
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"roles": [
{
"id": "<string>",
"name": "<string>"
}
],
"licenses": [
{
"id": "<string>",
"name": "<string>"
}
],
"organizationUnits": [
{
"id": "<string>",
"name": "<string>"
}
],
"credentialsRecipient": {
"type": "ADMIN",
"email": "<string>"
}
}
],
"selectedApps": [
{
"saasId": "<string>",
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"roles": [
{
"id": "<string>",
"name": "<string>"
}
],
"licenses": [
{
"id": "<string>",
"name": "<string>"
}
],
"organizationUnits": [
{
"id": "<string>",
"name": "<string>"
}
],
"credentialsRecipient": {
"type": "ADMIN",
"email": "<string>"
}
}
],
"executedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Authorizations
Body
A future date defers the account tasks until then: the selection task itself is scheduled on the new tasks interaction model, each account task elsewhere. Without it they start now.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$curl --request POST \
--url https://api.getprimo.com/saas-selection-intents/{intentId}/execute \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"apps": [
{
"saasId": "<string>",
"groups": [
{
"name": "<string>",
"id": "<string>"
}
],
"roles": [
{
"name": "<string>",
"id": "<string>"
}
],
"licenses": [
{
"name": "<string>",
"id": "<string>"
}
],
"organizationUnits": [
{
"name": "<string>",
"id": "<string>"
}
],
"credentialsRecipient": {
"email": "jsmith@example.com"
}
}
],
"scheduleDate": "2023-11-07T05:31:56Z",
"personalEmail": "jsmith@example.com"
}
'import requests
url = "https://api.getprimo.com/saas-selection-intents/{intentId}/execute"
payload = {
"apps": [
{
"saasId": "<string>",
"groups": [
{
"name": "<string>",
"id": "<string>"
}
],
"roles": [
{
"name": "<string>",
"id": "<string>"
}
],
"licenses": [
{
"name": "<string>",
"id": "<string>"
}
],
"organizationUnits": [
{
"name": "<string>",
"id": "<string>"
}
],
"credentialsRecipient": { "email": "jsmith@example.com" }
}
],
"scheduleDate": "2023-11-07T05:31:56Z",
"personalEmail": "jsmith@example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
apps: [
{
saasId: '<string>',
groups: [{name: '<string>', id: '<string>'}],
roles: [{name: '<string>', id: '<string>'}],
licenses: [{name: '<string>', id: '<string>'}],
organizationUnits: [{name: '<string>', id: '<string>'}],
credentialsRecipient: {email: 'jsmith@example.com'}
}
],
scheduleDate: '2023-11-07T05:31:56Z',
personalEmail: 'jsmith@example.com'
})
};
fetch('https://api.getprimo.com/saas-selection-intents/{intentId}/execute', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.getprimo.com/saas-selection-intents/{intentId}/execute",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'apps' => [
[
'saasId' => '<string>',
'groups' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'roles' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'licenses' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'organizationUnits' => [
[
'name' => '<string>',
'id' => '<string>'
]
],
'credentialsRecipient' => [
'email' => 'jsmith@example.com'
]
]
],
'scheduleDate' => '2023-11-07T05:31:56Z',
'personalEmail' => 'jsmith@example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.getprimo.com/saas-selection-intents/{intentId}/execute"
payload := strings.NewReader("{\n \"apps\": [\n {\n \"saasId\": \"<string>\",\n \"groups\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"licenses\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"organizationUnits\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"credentialsRecipient\": {\n \"email\": \"jsmith@example.com\"\n }\n }\n ],\n \"scheduleDate\": \"2023-11-07T05:31:56Z\",\n \"personalEmail\": \"jsmith@example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.getprimo.com/saas-selection-intents/{intentId}/execute")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"apps\": [\n {\n \"saasId\": \"<string>\",\n \"groups\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"licenses\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"organizationUnits\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"credentialsRecipient\": {\n \"email\": \"jsmith@example.com\"\n }\n }\n ],\n \"scheduleDate\": \"2023-11-07T05:31:56Z\",\n \"personalEmail\": \"jsmith@example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getprimo.com/saas-selection-intents/{intentId}/execute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"apps\": [\n {\n \"saasId\": \"<string>\",\n \"groups\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"roles\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"licenses\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"organizationUnits\": [\n {\n \"name\": \"<string>\",\n \"id\": \"<string>\"\n }\n ],\n \"credentialsRecipient\": {\n \"email\": \"jsmith@example.com\"\n }\n }\n ],\n \"scheduleDate\": \"2023-11-07T05:31:56Z\",\n \"personalEmail\": \"jsmith@example.com\"\n}"
response = http.request(request)
puts response.read_body{
"outcome": "EXECUTED",
"intent": {
"id": "<string>",
"taskId": "<string>",
"ticketId": "<string>",
"employeeId": "<string>",
"proposedApps": [
{
"saasId": "<string>",
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"roles": [
{
"id": "<string>",
"name": "<string>"
}
],
"licenses": [
{
"id": "<string>",
"name": "<string>"
}
],
"organizationUnits": [
{
"id": "<string>",
"name": "<string>"
}
],
"credentialsRecipient": {
"type": "ADMIN",
"email": "<string>"
}
}
],
"selectedApps": [
{
"saasId": "<string>",
"groups": [
{
"id": "<string>",
"name": "<string>"
}
],
"roles": [
{
"id": "<string>",
"name": "<string>"
}
],
"licenses": [
{
"id": "<string>",
"name": "<string>"
}
],
"organizationUnits": [
{
"id": "<string>",
"name": "<string>"
}
],
"credentialsRecipient": {
"type": "ADMIN",
"email": "<string>"
}
}
],
"executedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}