curl --request PATCH \
--url https://api.onesignal.com/apps/{app_id}/journeys/{id}/nodes/{node_id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"duration_seconds": 43200
}
'import Onesignal from '@onesignal/node-onesignal';
const configuration = Onesignal.createConfiguration({
restApiKey: 'YOUR_REST_API_KEY',
});
const apiInstance = new Onesignal.DefaultApi(configuration);
// string | Your OneSignal App ID in UUID v4 format.
const appId: string = "YOUR_APP_ID";
// string | UUID of the journey that owns the node.
const journeyId: string = "YOUR_JOURNEY_ID";
// string | Server-assigned UUID of the node to update, from a prior View journey fetch.
const nodeId: string = "YOUR_NODE_ID";
// UpdateJourneyNodeRequest
const updateJourneyNodeRequest: Onesignal.UpdateJourneyNodeRequest = {
client_node_id: "client_node_id_example",
annotation: "annotation_example",
duration_seconds: 60,
relative_to: "schedule_in_timezone",
windows: [
{
start: null,
end: null,
day_of_week: 1,
},
],
time_zone: "time_zone_example",
use_user_time_zone: true,
template_id: "template_id_example",
iam_id: "iam_id_example",
user_ttl_seconds: 1,
webhook_id: "webhook_id_example",
assignments: {
"key": "key_example",
},
randomize_on_entry: true,
branches: [
{
id: "id_example",
condition: {
kind: "segment_membership",
included_segment_ids: [
"included_segment_ids_example",
],
excluded_segment_ids: [
"excluded_segment_ids_example",
],
action: "received",
sending_node_id: "sending_node_id_example",
client_node_id: "client_node_id_example",
name: "name_example",
attributes: [
[
{
key: "key_example",
operator: "equal",
value: "value_example",
},
],
],
entry_event_match_attributes: [
{},
],
},
weight: 3.14,
nodes: [
{
id: "id_example",
kind: "wait",
client_node_id: "client_node_id_example",
annotation: "annotation_example",
duration_seconds: 60,
relative_to: "schedule_in_timezone",
windows: [
{
start: null,
end: null,
day_of_week: 1,
},
],
time_zone: "time_zone_example",
use_user_time_zone: true,
template_id: "template_id_example",
iam_id: "iam_id_example",
user_ttl_seconds: 1,
webhook_id: "webhook_id_example",
assignments: {
"key": "key_example",
},
randomize_on_entry: true,
branches: [],
expiration: {
duration_seconds: 60,
exits: true,
},
},
],
},
],
expiration: {
duration_seconds: 60,
exits: true,
},
concurrency_key: "concurrency_key_example",
};
try {
const response = await apiInstance.updateJourneyNode(appId, journeyId, nodeId, updateJourneyNodeRequest);
console.log(response);
} catch (e) {
if (e instanceof Onesignal.ApiException) {
// `e.errorMessages` flattens any error-envelope shape to a `string[]`;
// the raw parsed body remains on `e.body`.
console.error("updateJourneyNode failed: HTTP " + e.code, e.errorMessages);
} else {
throw e;
}
}import onesignal
from onesignal.api import default_api
from onesignal.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
# Some of the OneSignal endpoints require ORGANIZATION_API_KEY token for authorization, while others require REST_API_KEY.
# We recommend adding both of them in the configuration page so that you will not need to figure it out yourself.
configuration = onesignal.Configuration(
rest_api_key = "YOUR_REST_API_KEY", # App REST API key required for most endpoints
organization_api_key = "YOUR_ORGANIZATION_API_KEY" # Organization key is only required for creating new apps and other top-level endpoints
)
# Enter a context with an instance of the API client
with onesignal.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
app_id = "YOUR_APP_ID" # Your OneSignal App ID in UUID v4 format.
journey_id = "YOUR_JOURNEY_ID" # UUID of the journey that owns the node.
node_id = "YOUR_NODE_ID" # Server-assigned UUID of the node to update, from a prior View journey fetch.
update_journey_node_request = UpdateJourneyNodeRequest(
client_node_id="client_node_id_example",
annotation="annotation_example",
duration_seconds=60,
relative_to="schedule_in_timezone",
windows=[
JourneyTimeWindow(
start=None,
end=None,
day_of_week=1,
),
],
time_zone="time_zone_example",
use_user_time_zone=True,
template_id="template_id_example",
iam_id="iam_id_example",
user_ttl_seconds=1,
webhook_id="webhook_id_example",
assignments={
"key": "key_example",
},
randomize_on_entry=True,
branches=[
JourneyBranch(
id="id_example",
condition=JourneyCondition(
kind="segment_membership",
included_segment_ids=[
"included_segment_ids_example",
],
excluded_segment_ids=[
"excluded_segment_ids_example",
],
action="received",
sending_node_id="sending_node_id_example",
client_node_id="client_node_id_example",
name="name_example",
attributes=JourneyEventTriggerAttributes([
[
JourneyEventAttribute(
key="key_example",
operator="equal",
value="value_example",
),
],
]),
entry_event_match_attributes=[
{},
],
),
weight=3.14,
nodes=[
JourneyNode(
id="id_example",
kind="wait",
client_node_id="client_node_id_example",
annotation="annotation_example",
duration_seconds=60,
relative_to="schedule_in_timezone",
windows=[
JourneyTimeWindow(
start=None,
end=None,
day_of_week=1,
),
],
time_zone="time_zone_example",
use_user_time_zone=True,
template_id="template_id_example",
iam_id="iam_id_example",
user_ttl_seconds=1,
webhook_id="webhook_id_example",
assignments={
"key": "key_example",
},
randomize_on_entry=True,
branches=[],
expiration=JourneyWaitUntilExpiration(
duration_seconds=60,
exits=True,
),
),
],
),
],
expiration=JourneyWaitUntilExpiration(
duration_seconds=60,
exits=True,
),
concurrency_key="concurrency_key_example",
)
try:
# Update journey node
api_response = api_instance.update_journey_node(app_id, journey_id, node_id, update_journey_node_request)
pprint(api_response)
except onesignal.ApiException as e:
print("Exception when calling DefaultApi->update_journey_node: %s\n" % e)
print("Status Code: %s" % e.status)
print("Response Body: %s" % e.body)<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: rest_api_key
$config = onesignal\client\Configuration::getDefaultConfiguration()
->setRestApiKeyToken('YOUR_REST_API_KEY')
->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY');
$apiInstance = new onesignal\client\Api\DefaultApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format.
$journey_id = 'YOUR_JOURNEY_ID'; // string | UUID of the journey that owns the node.
$node_id = 'YOUR_NODE_ID'; // string | Server-assigned UUID of the node to update, from a prior View journey fetch.
$update_journey_node_request = new \onesignal\client\model\UpdateJourneyNodeRequest(); // \onesignal\client\model\UpdateJourneyNodeRequest
try {
$result = $apiInstance->updateJourneyNode($app_id, $journey_id, $node_id, $update_journey_node_request);
print_r($result);
} catch (\onesignal\client\ApiException $e) {
echo 'Exception when calling DefaultApi->updateJourneyNode: ', $e->getMessage(), PHP_EOL;
echo 'Status Code: ', $e->getCode(), PHP_EOL;
// getErrorMessages() flattens any error-envelope shape to a string[];
// the raw body remains on getResponseBody().
echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL;
echo 'Response Body: ', $e->getResponseBody(), PHP_EOL;
} catch (\Exception $e) {
echo 'Exception when calling DefaultApi->updateJourneyNode: ', $e->getMessage(), PHP_EOL;
}package main
import (
"context"
"fmt"
"os"
"github.com/OneSignal/onesignal-go-api/v5"
)
func main() {
appId := "YOUR_APP_ID" // string | Your OneSignal App ID in UUID v4 format.
journeyId := "YOUR_JOURNEY_ID" // string | UUID of the journey that owns the node.
nodeId := "YOUR_NODE_ID" // string | Server-assigned UUID of the node to update, from a prior View journey fetch.
updateJourneyNodeRequest := *onesignal.NewUpdateJourneyNodeRequest() // UpdateJourneyNodeRequest |
configuration := onesignal.NewConfiguration()
apiClient := onesignal.NewAPIClient(configuration)
restAuth := context.WithValue(context.Background(), onesignal.RestApiKey, "YOUR_REST_API_KEY") // App REST API key required for most endpoints
resp, r, err := apiClient.DefaultApi.UpdateJourneyNode(restAuth, appId, journeyId, nodeId).UpdateJourneyNodeRequest(updateJourneyNodeRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UpdateJourneyNode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
if apiErr, ok := err.(*onesignal.GenericOpenAPIError); ok {
// ErrorMessages() flattens any error-envelope shape to a []string;
// the raw body remains on Body().
fmt.Fprintf(os.Stderr, "Error Messages: %v\n", apiErr.ErrorMessages())
fmt.Fprintf(os.Stderr, "Response Body: %s\n", apiErr.Body())
}
}
// response from `UpdateJourneyNode`: Journey
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.UpdateJourneyNode`: %v\n", resp)
}require 'onesignal'
# setup authorization
OneSignal.configure do |config|
# Configure Bearer authorization: rest_api_key
config.rest_api_key = 'YOUR_REST_API_KEY'
end
api_instance = OneSignal::DefaultApi.new
app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format.
journey_id = 'YOUR_JOURNEY_ID' # String | UUID of the journey that owns the node.
node_id = 'YOUR_NODE_ID' # String | Server-assigned UUID of the node to update, from a prior View journey fetch.
update_journey_node_request = OneSignal::UpdateJourneyNodeRequest.new # UpdateJourneyNodeRequest |
begin
# Update journey node
result = api_instance.update_journey_node(app_id, journey_id, node_id, update_journey_node_request)
p result
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->update_journey_node: #{e}"
puts "Status Code: #{e.code}"
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
# the raw body remains on `e.response_body`.
puts "Error Messages: #{e.error_messages}"
puts "Response Body: #{e.response_body}"
end// Import classes:
import com.onesignal.client.ApiClient;
import com.onesignal.client.ApiException;
import com.onesignal.client.Configuration;
import com.onesignal.client.auth.*;
import com.onesignal.client.model.*;
import com.onesignal.client.api.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.onesignal.com");
// Configure HTTP bearer authorization: rest_api_key
HttpBearerAuth rest_api_key = (HttpBearerAuth) defaultClient.getAuthentication("rest_api_key");
rest_api_key.setBearerToken("YOUR_REST_API_KEY");
DefaultApi apiInstance = new DefaultApi(defaultClient);
String appId = "YOUR_APP_ID"; // String | Your OneSignal App ID in UUID v4 format.
String journeyId = "YOUR_JOURNEY_ID"; // String | UUID of the journey that owns the node.
String nodeId = "YOUR_NODE_ID"; // String | Server-assigned UUID of the node to update, from a prior View journey fetch.
UpdateJourneyNodeRequest updateJourneyNodeRequest = new UpdateJourneyNodeRequest(); // UpdateJourneyNodeRequest |
try {
Journey result = apiInstance.updateJourneyNode(appId, journeyId, nodeId, updateJourneyNodeRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#updateJourneyNode");
System.err.println("Status code: " + e.getCode());
// getErrorMessages() flattens any error-envelope shape to a List<String>;
// the raw body remains on getResponseBody().
System.err.println("Error messages: " + e.getErrorMessages());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}using System;
using System.Collections.Generic;
using System.Diagnostics;
using OneSignalApi.Api;
using OneSignalApi.Client;
using OneSignalApi.Model;
namespace Example
{
public class UpdateJourneyNodeExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.onesignal.com";
// Configure Bearer token for authorization: rest_api_key
config.AccessToken = "YOUR_REST_API_KEY";
var apiInstance = new DefaultApi(config);
var appId = "YOUR_APP_ID"; // string | Your OneSignal App ID in UUID v4 format.
var journeyId = "YOUR_JOURNEY_ID"; // string | UUID of the journey that owns the node.
var nodeId = "YOUR_NODE_ID"; // string | Server-assigned UUID of the node to update, from a prior View journey fetch.
var updateJourneyNodeRequest = new UpdateJourneyNodeRequest(); // UpdateJourneyNodeRequest |
try
{
// Update journey node
Journey result = apiInstance.UpdateJourneyNode(appId, journeyId, nodeId, updateJourneyNodeRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.UpdateJourneyNode: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
// e.ErrorMessages flattens any error-envelope shape to an IReadOnlyList<string>;
// the raw body remains on e.ErrorContent.
Debug.Print("Error Messages: " + string.Join(", ", e.ErrorMessages));
Debug.Print("Response Body: " + e.ErrorContent);
Debug.Print(e.StackTrace);
}
}
}
}use onesignal_rust_api::apis::configuration::Configuration;
use onesignal_rust_api::apis::default_api;
use onesignal_rust_api::models;
#[tokio::main]
async fn main() {
let mut configuration = Configuration::new();
configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string());
// Realistic values are pulled from the spec's `example:` fields where present.
let app_id: &str = "YOUR_APP_ID";
let journey_id: &str = "YOUR_JOURNEY_ID";
let node_id: &str = "YOUR_NODE_ID";
let update_journey_node_request: models::UpdateJourneyNodeRequest = todo!();
match default_api::update_journey_node(&configuration, app_id, journey_id, node_id, update_journey_node_request).await {
Ok(resp) => println!("{:?}", resp),
Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => {
// `e.error_messages()` flattens any error-envelope shape to a Vec<String>;
// the raw response remains on the ResponseError variant.
eprintln!("update_journey_node failed: {:?}", e.error_messages());
}
Err(e) => eprintln!("update_journey_node failed: {:?}", e),
}
}{
"id": "<string>",
"app_id": "<string>",
"name": "<string>",
"description": "<string>",
"state": "draft",
"created_at": "<string>",
"updated_at": "<string>",
"started_at": "<string>",
"archived_at": "<string>",
"created_source": "<string>",
"audience": {
"kind": "segment",
"included_segment_ids": [
"<string>"
],
"excluded_segment_ids": [
"<string>"
],
"future_additions_only": true
},
"early_exit": {
"rules": {
"on_segment": {
"included_segment_ids": [
"<string>"
]
},
"when_not_in_audience": true,
"on_session": true,
"on_event": {
"name": "<string>"
}
},
"tag_on_early_exit": {}
},
"reentry_rules": {
"duration_seconds": 601
},
"schedule": {
"start_at": "<string>",
"stop_at": "<string>",
"error": "<string>"
},
"nodes": [
{
"kind": "wait",
"id": "<string>",
"client_node_id": "<string>",
"annotation": "<string>",
"duration_seconds": 15778506
}
],
"concurrency_key": "<string>"
}{
"errors": [
{
"code": "invalid-payload",
"title": "the property '#/nodes/1/bogus' is not defined and the schema does not allow additional properties",
"meta": {
"attribute": "base"
}
}
]
}{
"errors": [
{
"code": "journey-not-entitled",
"title": "Journeys are not enabled for this app",
"meta": {}
}
]
}{
"errors": [
{
"code": "journey-node-not-found",
"title": "Node not found",
"meta": {}
}
]
}{
"errors": [
{
"code": "journey-stale",
"title": "Journey has changed since it was last fetched",
"meta": {}
}
]
}{
"errors": [
{
"code": "journey-archived",
"title": "Archived Journeys cannot be edited",
"meta": {}
}
]
}Update journey node
Apply a partial update to a single journey node, located by its server-assigned id, with JSON Merge Patch.
curl --request PATCH \
--url https://api.onesignal.com/apps/{app_id}/journeys/{id}/nodes/{node_id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"duration_seconds": 43200
}
'import Onesignal from '@onesignal/node-onesignal';
const configuration = Onesignal.createConfiguration({
restApiKey: 'YOUR_REST_API_KEY',
});
const apiInstance = new Onesignal.DefaultApi(configuration);
// string | Your OneSignal App ID in UUID v4 format.
const appId: string = "YOUR_APP_ID";
// string | UUID of the journey that owns the node.
const journeyId: string = "YOUR_JOURNEY_ID";
// string | Server-assigned UUID of the node to update, from a prior View journey fetch.
const nodeId: string = "YOUR_NODE_ID";
// UpdateJourneyNodeRequest
const updateJourneyNodeRequest: Onesignal.UpdateJourneyNodeRequest = {
client_node_id: "client_node_id_example",
annotation: "annotation_example",
duration_seconds: 60,
relative_to: "schedule_in_timezone",
windows: [
{
start: null,
end: null,
day_of_week: 1,
},
],
time_zone: "time_zone_example",
use_user_time_zone: true,
template_id: "template_id_example",
iam_id: "iam_id_example",
user_ttl_seconds: 1,
webhook_id: "webhook_id_example",
assignments: {
"key": "key_example",
},
randomize_on_entry: true,
branches: [
{
id: "id_example",
condition: {
kind: "segment_membership",
included_segment_ids: [
"included_segment_ids_example",
],
excluded_segment_ids: [
"excluded_segment_ids_example",
],
action: "received",
sending_node_id: "sending_node_id_example",
client_node_id: "client_node_id_example",
name: "name_example",
attributes: [
[
{
key: "key_example",
operator: "equal",
value: "value_example",
},
],
],
entry_event_match_attributes: [
{},
],
},
weight: 3.14,
nodes: [
{
id: "id_example",
kind: "wait",
client_node_id: "client_node_id_example",
annotation: "annotation_example",
duration_seconds: 60,
relative_to: "schedule_in_timezone",
windows: [
{
start: null,
end: null,
day_of_week: 1,
},
],
time_zone: "time_zone_example",
use_user_time_zone: true,
template_id: "template_id_example",
iam_id: "iam_id_example",
user_ttl_seconds: 1,
webhook_id: "webhook_id_example",
assignments: {
"key": "key_example",
},
randomize_on_entry: true,
branches: [],
expiration: {
duration_seconds: 60,
exits: true,
},
},
],
},
],
expiration: {
duration_seconds: 60,
exits: true,
},
concurrency_key: "concurrency_key_example",
};
try {
const response = await apiInstance.updateJourneyNode(appId, journeyId, nodeId, updateJourneyNodeRequest);
console.log(response);
} catch (e) {
if (e instanceof Onesignal.ApiException) {
// `e.errorMessages` flattens any error-envelope shape to a `string[]`;
// the raw parsed body remains on `e.body`.
console.error("updateJourneyNode failed: HTTP " + e.code, e.errorMessages);
} else {
throw e;
}
}import onesignal
from onesignal.api import default_api
from onesignal.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
# Some of the OneSignal endpoints require ORGANIZATION_API_KEY token for authorization, while others require REST_API_KEY.
# We recommend adding both of them in the configuration page so that you will not need to figure it out yourself.
configuration = onesignal.Configuration(
rest_api_key = "YOUR_REST_API_KEY", # App REST API key required for most endpoints
organization_api_key = "YOUR_ORGANIZATION_API_KEY" # Organization key is only required for creating new apps and other top-level endpoints
)
# Enter a context with an instance of the API client
with onesignal.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = default_api.DefaultApi(api_client)
app_id = "YOUR_APP_ID" # Your OneSignal App ID in UUID v4 format.
journey_id = "YOUR_JOURNEY_ID" # UUID of the journey that owns the node.
node_id = "YOUR_NODE_ID" # Server-assigned UUID of the node to update, from a prior View journey fetch.
update_journey_node_request = UpdateJourneyNodeRequest(
client_node_id="client_node_id_example",
annotation="annotation_example",
duration_seconds=60,
relative_to="schedule_in_timezone",
windows=[
JourneyTimeWindow(
start=None,
end=None,
day_of_week=1,
),
],
time_zone="time_zone_example",
use_user_time_zone=True,
template_id="template_id_example",
iam_id="iam_id_example",
user_ttl_seconds=1,
webhook_id="webhook_id_example",
assignments={
"key": "key_example",
},
randomize_on_entry=True,
branches=[
JourneyBranch(
id="id_example",
condition=JourneyCondition(
kind="segment_membership",
included_segment_ids=[
"included_segment_ids_example",
],
excluded_segment_ids=[
"excluded_segment_ids_example",
],
action="received",
sending_node_id="sending_node_id_example",
client_node_id="client_node_id_example",
name="name_example",
attributes=JourneyEventTriggerAttributes([
[
JourneyEventAttribute(
key="key_example",
operator="equal",
value="value_example",
),
],
]),
entry_event_match_attributes=[
{},
],
),
weight=3.14,
nodes=[
JourneyNode(
id="id_example",
kind="wait",
client_node_id="client_node_id_example",
annotation="annotation_example",
duration_seconds=60,
relative_to="schedule_in_timezone",
windows=[
JourneyTimeWindow(
start=None,
end=None,
day_of_week=1,
),
],
time_zone="time_zone_example",
use_user_time_zone=True,
template_id="template_id_example",
iam_id="iam_id_example",
user_ttl_seconds=1,
webhook_id="webhook_id_example",
assignments={
"key": "key_example",
},
randomize_on_entry=True,
branches=[],
expiration=JourneyWaitUntilExpiration(
duration_seconds=60,
exits=True,
),
),
],
),
],
expiration=JourneyWaitUntilExpiration(
duration_seconds=60,
exits=True,
),
concurrency_key="concurrency_key_example",
)
try:
# Update journey node
api_response = api_instance.update_journey_node(app_id, journey_id, node_id, update_journey_node_request)
pprint(api_response)
except onesignal.ApiException as e:
print("Exception when calling DefaultApi->update_journey_node: %s\n" % e)
print("Status Code: %s" % e.status)
print("Response Body: %s" % e.body)<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: rest_api_key
$config = onesignal\client\Configuration::getDefaultConfiguration()
->setRestApiKeyToken('YOUR_REST_API_KEY')
->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY');
$apiInstance = new onesignal\client\Api\DefaultApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format.
$journey_id = 'YOUR_JOURNEY_ID'; // string | UUID of the journey that owns the node.
$node_id = 'YOUR_NODE_ID'; // string | Server-assigned UUID of the node to update, from a prior View journey fetch.
$update_journey_node_request = new \onesignal\client\model\UpdateJourneyNodeRequest(); // \onesignal\client\model\UpdateJourneyNodeRequest
try {
$result = $apiInstance->updateJourneyNode($app_id, $journey_id, $node_id, $update_journey_node_request);
print_r($result);
} catch (\onesignal\client\ApiException $e) {
echo 'Exception when calling DefaultApi->updateJourneyNode: ', $e->getMessage(), PHP_EOL;
echo 'Status Code: ', $e->getCode(), PHP_EOL;
// getErrorMessages() flattens any error-envelope shape to a string[];
// the raw body remains on getResponseBody().
echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL;
echo 'Response Body: ', $e->getResponseBody(), PHP_EOL;
} catch (\Exception $e) {
echo 'Exception when calling DefaultApi->updateJourneyNode: ', $e->getMessage(), PHP_EOL;
}package main
import (
"context"
"fmt"
"os"
"github.com/OneSignal/onesignal-go-api/v5"
)
func main() {
appId := "YOUR_APP_ID" // string | Your OneSignal App ID in UUID v4 format.
journeyId := "YOUR_JOURNEY_ID" // string | UUID of the journey that owns the node.
nodeId := "YOUR_NODE_ID" // string | Server-assigned UUID of the node to update, from a prior View journey fetch.
updateJourneyNodeRequest := *onesignal.NewUpdateJourneyNodeRequest() // UpdateJourneyNodeRequest |
configuration := onesignal.NewConfiguration()
apiClient := onesignal.NewAPIClient(configuration)
restAuth := context.WithValue(context.Background(), onesignal.RestApiKey, "YOUR_REST_API_KEY") // App REST API key required for most endpoints
resp, r, err := apiClient.DefaultApi.UpdateJourneyNode(restAuth, appId, journeyId, nodeId).UpdateJourneyNodeRequest(updateJourneyNodeRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UpdateJourneyNode``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
if apiErr, ok := err.(*onesignal.GenericOpenAPIError); ok {
// ErrorMessages() flattens any error-envelope shape to a []string;
// the raw body remains on Body().
fmt.Fprintf(os.Stderr, "Error Messages: %v\n", apiErr.ErrorMessages())
fmt.Fprintf(os.Stderr, "Response Body: %s\n", apiErr.Body())
}
}
// response from `UpdateJourneyNode`: Journey
fmt.Fprintf(os.Stdout, "Response from `DefaultApi.UpdateJourneyNode`: %v\n", resp)
}require 'onesignal'
# setup authorization
OneSignal.configure do |config|
# Configure Bearer authorization: rest_api_key
config.rest_api_key = 'YOUR_REST_API_KEY'
end
api_instance = OneSignal::DefaultApi.new
app_id = 'YOUR_APP_ID' # String | Your OneSignal App ID in UUID v4 format.
journey_id = 'YOUR_JOURNEY_ID' # String | UUID of the journey that owns the node.
node_id = 'YOUR_NODE_ID' # String | Server-assigned UUID of the node to update, from a prior View journey fetch.
update_journey_node_request = OneSignal::UpdateJourneyNodeRequest.new # UpdateJourneyNodeRequest |
begin
# Update journey node
result = api_instance.update_journey_node(app_id, journey_id, node_id, update_journey_node_request)
p result
rescue OneSignal::ApiError => e
puts "Error when calling DefaultApi->update_journey_node: #{e}"
puts "Status Code: #{e.code}"
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
# the raw body remains on `e.response_body`.
puts "Error Messages: #{e.error_messages}"
puts "Response Body: #{e.response_body}"
end// Import classes:
import com.onesignal.client.ApiClient;
import com.onesignal.client.ApiException;
import com.onesignal.client.Configuration;
import com.onesignal.client.auth.*;
import com.onesignal.client.model.*;
import com.onesignal.client.api.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.onesignal.com");
// Configure HTTP bearer authorization: rest_api_key
HttpBearerAuth rest_api_key = (HttpBearerAuth) defaultClient.getAuthentication("rest_api_key");
rest_api_key.setBearerToken("YOUR_REST_API_KEY");
DefaultApi apiInstance = new DefaultApi(defaultClient);
String appId = "YOUR_APP_ID"; // String | Your OneSignal App ID in UUID v4 format.
String journeyId = "YOUR_JOURNEY_ID"; // String | UUID of the journey that owns the node.
String nodeId = "YOUR_NODE_ID"; // String | Server-assigned UUID of the node to update, from a prior View journey fetch.
UpdateJourneyNodeRequest updateJourneyNodeRequest = new UpdateJourneyNodeRequest(); // UpdateJourneyNodeRequest |
try {
Journey result = apiInstance.updateJourneyNode(appId, journeyId, nodeId, updateJourneyNodeRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#updateJourneyNode");
System.err.println("Status code: " + e.getCode());
// getErrorMessages() flattens any error-envelope shape to a List<String>;
// the raw body remains on getResponseBody().
System.err.println("Error messages: " + e.getErrorMessages());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}using System;
using System.Collections.Generic;
using System.Diagnostics;
using OneSignalApi.Api;
using OneSignalApi.Client;
using OneSignalApi.Model;
namespace Example
{
public class UpdateJourneyNodeExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.onesignal.com";
// Configure Bearer token for authorization: rest_api_key
config.AccessToken = "YOUR_REST_API_KEY";
var apiInstance = new DefaultApi(config);
var appId = "YOUR_APP_ID"; // string | Your OneSignal App ID in UUID v4 format.
var journeyId = "YOUR_JOURNEY_ID"; // string | UUID of the journey that owns the node.
var nodeId = "YOUR_NODE_ID"; // string | Server-assigned UUID of the node to update, from a prior View journey fetch.
var updateJourneyNodeRequest = new UpdateJourneyNodeRequest(); // UpdateJourneyNodeRequest |
try
{
// Update journey node
Journey result = apiInstance.UpdateJourneyNode(appId, journeyId, nodeId, updateJourneyNodeRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DefaultApi.UpdateJourneyNode: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
// e.ErrorMessages flattens any error-envelope shape to an IReadOnlyList<string>;
// the raw body remains on e.ErrorContent.
Debug.Print("Error Messages: " + string.Join(", ", e.ErrorMessages));
Debug.Print("Response Body: " + e.ErrorContent);
Debug.Print(e.StackTrace);
}
}
}
}use onesignal_rust_api::apis::configuration::Configuration;
use onesignal_rust_api::apis::default_api;
use onesignal_rust_api::models;
#[tokio::main]
async fn main() {
let mut configuration = Configuration::new();
configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string());
// Realistic values are pulled from the spec's `example:` fields where present.
let app_id: &str = "YOUR_APP_ID";
let journey_id: &str = "YOUR_JOURNEY_ID";
let node_id: &str = "YOUR_NODE_ID";
let update_journey_node_request: models::UpdateJourneyNodeRequest = todo!();
match default_api::update_journey_node(&configuration, app_id, journey_id, node_id, update_journey_node_request).await {
Ok(resp) => println!("{:?}", resp),
Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => {
// `e.error_messages()` flattens any error-envelope shape to a Vec<String>;
// the raw response remains on the ResponseError variant.
eprintln!("update_journey_node failed: {:?}", e.error_messages());
}
Err(e) => eprintln!("update_journey_node failed: {:?}", e),
}
}{
"id": "<string>",
"app_id": "<string>",
"name": "<string>",
"description": "<string>",
"state": "draft",
"created_at": "<string>",
"updated_at": "<string>",
"started_at": "<string>",
"archived_at": "<string>",
"created_source": "<string>",
"audience": {
"kind": "segment",
"included_segment_ids": [
"<string>"
],
"excluded_segment_ids": [
"<string>"
],
"future_additions_only": true
},
"early_exit": {
"rules": {
"on_segment": {
"included_segment_ids": [
"<string>"
]
},
"when_not_in_audience": true,
"on_session": true,
"on_event": {
"name": "<string>"
}
},
"tag_on_early_exit": {}
},
"reentry_rules": {
"duration_seconds": 601
},
"schedule": {
"start_at": "<string>",
"stop_at": "<string>",
"error": "<string>"
},
"nodes": [
{
"kind": "wait",
"id": "<string>",
"client_node_id": "<string>",
"annotation": "<string>",
"duration_seconds": 15778506
}
],
"concurrency_key": "<string>"
}{
"errors": [
{
"code": "invalid-payload",
"title": "the property '#/nodes/1/bogus' is not defined and the schema does not allow additional properties",
"meta": {
"attribute": "base"
}
}
]
}{
"errors": [
{
"code": "journey-not-entitled",
"title": "Journeys are not enabled for this app",
"meta": {}
}
]
}{
"errors": [
{
"code": "journey-node-not-found",
"title": "Node not found",
"meta": {}
}
]
}{
"errors": [
{
"code": "journey-stale",
"title": "Journey has changed since it was last fetched",
"meta": {}
}
]
}{
"errors": [
{
"code": "journey-archived",
"title": "Archived Journeys cannot be edited",
"meta": {}
}
]
}Overview
Update a single node within an existing Journey. The request is a JSON Merge Patch (RFC 7396): send only the node fields you want to change, and the rest of the node, along with the rest of the journey graph, is left unchanged.nodes array wholesale, so it requires re-sending every node with its id. This endpoint touches just the addressed node and preserves in-flight users on the others.How to use this API
Authenticate with your App API Key. The authenticated key must have permission to update journeys. Find the journeyid and the node id from a prior View journey fetch.
Send only the fields to change. Node fields follow the same schema and validation as Create journey. For example, to shorten a wait node’s delay:
{
"duration_seconds": 43200
}
Merge patch behavior
The request body is merged onto the addressed node:- A field you send replaces the current value. Omitted fields are untouched.
- A
nullvalue clears a nullable field. Send"expiration": nullon await_untilnode to wait indefinitely. - Arrays are replaced as a unit.
branchesandwindowsare not merged element-wise. Send the full array you want. - A node’s
kindand its server-assignedidcannot be changed. A node keeps its kind for the life of itsid, so changing thekindis rejected (send_push,send_email, andsend_smscount as different kinds).
Optimistic concurrency
To avoid overwriting a concurrent change, pass theconcurrency_key returned by a prior View journey fetch. If the journey has changed since that fetch, the request is rejected with 409 journey-stale and nothing is written. Omit concurrency_key to skip the check.
The key covers the whole journey, not just the addressed node, so a concurrent edit to any part of the journey rejects the request. concurrency_key is not merged onto the node.
concurrency_key as an opaque token: read it from the journey you are editing and send it back unchanged. Do not construct, parse, or compare it yourself.{
"duration_seconds": 43200,
"concurrency_key": "dcae4794fee16e450e448e37a6f8d0a5a7335755ff8cc76606e3d04b2f574e46"
}
Editing an active journey
The same active-journey rules as Update journey apply. An edit that would strand in-flight users (for example, changing a branching node’s branches) returns400 with a field-level error.
Response
A successful request returns200 OK with the full updated journey, including server-assigned id fields and a concurrency_key. Pass that concurrency_key unchanged on a later update to avoid overwriting a concurrent change.
Error responses
| Status | Code | Description |
|---|---|---|
| 400 | invalid-payload | The request failed validation. This covers schema failures and business-logic failures such as editing a structural node on an active journey. |
| 403 | journey-not-entitled | Journeys are not enabled for this app. |
| 404 | journey-not-found | No journey with that id exists for this app. |
| 404 | journey-node-not-found | No node with that node_id exists in the journey. |
| 409 | journey-stale | The supplied concurrency_key no longer matches the journey; it changed since it was last fetched. |
| 422 | journey-archived | Archived journeys cannot be edited. |
| 429 | Rate limit exceeded. Wait the number of seconds in the Retry-After header before retrying. See Rate limits. |
{ "errors": [{ "code", "title", "meta" }] }. For validation errors the failing field is in meta.attribute. Schema failures on this endpoint are reported against the merged journey, so the offending property is identified in the message by its position in the full graph, such as #/nodes/1/bogus.Path Parameters
Your OneSignal App ID in UUID v4 format. See Keys & IDs.
UUID of the journey that owns the node.
Server-assigned UUID of the node to update, from a prior View journey fetch.
Body
Node fields to change, merged onto the current node. The node's kind and id cannot be changed. Send null to clear a nullable field.
Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed in the meantime. Omit to skip the check. It is not merged onto the node.
Response
200
Full journey representation returned by the detail and create endpoints.
Journey UUID. Read-only.
UUID of the app the journey belongs to. Read-only.
Journey name, up to 300 characters.
Journey description, up to 1024 characters. Defaults to an empty string.
Journey state. Read-only. New journeys are created as draft. processing is a transient state while an activation is in progress, and archived is a journey that has been stopped. Change it through the state field on Update journey.
draft, scheduled, processing, active, archived ISO 8601 creation time. Read-only.
ISO 8601 last-update time. Read-only.
ISO 8601 time the journey was activated, or null. Read-only. May stay null briefly after you set state to active: activation is enqueued for processing, and started_at populates once the journey finishes processing and becomes active.
ISO 8601 time the journey was archived, or null. Read-only.
Origin of the journey, for example public_api or dashboard. Read-only.
The journey entry audience. Either a segment-based or event-triggered audience.
- segment
- event_trigger
Show child attributes
Show child attributes
Conditions that remove a user from the journey before it completes. At least one rule must be set under rules; an early_exit that configures no rule is rejected. Send null to remove early exit entirely, or null for an individual rule to drop just that rule.
Show child attributes
Show child attributes
Controls whether and how soon a user can re-enter the journey. null means re-entry is not allowed.
Show child attributes
Show child attributes
Optional future start and/or stop time. null means no scheduled activation.
Show child attributes
Show child attributes
Ordered list of journey nodes.
A journey node. The kind field selects the shape. Branching nodes (split_range, yes_no, wait_until) nest their sub-graphs inline via branches[].nodes.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
Show child attributes
Show child attributes
Opaque optimistic-concurrency token. Read-only. Pass it back on update to guard against overwriting a concurrent change (409 journey-stale). Send it back exactly as read from this response; do not construct or parse it.
Was this page helpful?