Integrate Software AG Products Using Digital Event Services 10.4 | Integrate Software AG Products Using Digital Event Services | MashZone NextGen Help | Appendix | Legacy Presto components | MashZone NextGen Development and APIs | MashZone NextGen APIs | MashZone NextGen Snapshot API | Take or Delete Snapshot Methods | Take a Temporary Snapshot and Save Separately
 
Take a Temporary Snapshot and Save Separately
With this pattern, you create a temporary snapshot when you run a mashable or mashup and choose to save it permanently in a separate request.
Note: Temporary snapshots must be saved within 25 minutes of their capture. After that, the MashZone NextGen Server discards the temporary snapshot.
You use the MashZone NextGen REST URL to run the mashable or mashup, but include only the x-p-enableSnapshot MashZone NextGen header. For example:
http://app-server:port/mashzone/edge/api/rest/service/operation?service-params-if-any&x-p-enableSnapshot=true
Add input parameters to the URL or a request body, as needed, plus any other MashZone NextGen headers you need. You can find the REST API URL for any mashables or mashup in the Technical Specs tab on its artifact page. See Use Mashable/Mashup Technical Specs for more information.
MashZone NextGen assigns a snapshot ID to the temporary snapshot and returns this ID in the snapshotToken HTTP header of the response, such as this example:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
...
cache-control: private, max-age=1200
serviceURL: http://localhost:8080/mashzone/edge/api/rest/YahooWeatherREST/getData?p%3D94572
snapshotToken: 7ac5fe05-2e67-11e0-952d-adff03bd533b
...
When you are sure you want to save this as a permanent snapshot, send an HTTP POST request to this URL:
http://app-server:port/mashzone/edge/api/rest/snapshot
Use the following POST body with the snapshot ID returned when the snapshot was taken and the appropriate metadata for this snapshot.
POST Body

<snapshot xmlns="http://www.jackbe.com/2009-08-01/snapshot"
id="a2da57e1-2a60-11e0-9f1b-69cef3c615e5">
<name>mySnapshot</name>
<service>mashableA</service>
<operation>operationName</operation>
<createdby>userA</createdby>
<description>Snapshot of some kind of data...</description>
<tags>
<tag>tag1</tag>
<tag>tag2</tag>
<tag>tag3</tag>
</tags>
</snapshot>

Copyright © 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release