Buffer values

Use dynamic buffer values for your step properties to generate them at runtime. If you need values of message elements within your virtual service more than once, use the Buffer property to temporarily save them. You can read these buffer values within the virtual service and insert them into another message element.

Create buffer values

To buffer a value, you need the following:

  • The buffer property with a buffer name to find the buffer values again. Buffer names aren't case-sensitive.

  • Optionally, you can use step rules properties to specify the part of a value that you want to reuse. For example, this could be a specific dynamic value, or it could be part of a path.

Read buffered values

To reuse a buffered value for a message element, use the Insert step property with the value {B[<buffer name>]}.

Read buffered values into the payload of a message

Typically, you need a path to insert a buffered value into a specific section of the message that you want to send. This can be a challenge with complex payloads, especially those with many special characters.

However, you can read a buffered value and insert it directly into the payload of a message using the payload property with the %{<buffer name>} syntax. You can insert the syntax anywhere in the payload text.

Use multiple buffer values

You can split the value of a message element and buffer it separately. Typically, these are values from a table or database divided by a separator. API simulation creates a separate buffer with consecutive numbers for each partial value.

Create multiple buffer values

To split a value and store it as a buffer, you need the following:

  • The buffer property with a buffer name to find the buffer values again

  • A value with the syntax {SPLITBUFFER[<Separator>]} to identify the individual parts of a value

Read buffered partial values

Reuse a buffered partial value for a message element using the syntax {B[<Buffer name><number>]}. You need the buffer name along with the corresponding buffer value number and the Insert property.

Use a dynamic buffer value

You can store a dynamic value within a static string as a buffer. For example, this could be a data string where only the ID changes and you want to reuse that ID.

Create dynamic buffer values

To buffer a value within a string, use the buffer property with the value <string>{XB[<Buffer name>]}<string>.

Read buffered values

Reuse dynamic buffer values in the same way as buffer values.