In this example, we use a REST Post Snap to add attachments
to a Jira issue.
You design the pipeline as shown below. This pipeline
contains the following Snaps:
.png)
Download this Pipeline
- Creating the Jira Ticket
- File Reader: Reads a file containing the details
required to create a ticket in Jira.
- JSON Parser: Structures the data received from
the File Reader Snap as a JSON document.
- Mapper: Creates a document containing the data
needed to create a Jira ticket, by extracting and mapping data from the
incoming document.
- JIRA Create: Creates a Jira ticket using the
details provided by the Mapper Snap.
- Updating the Jira Ticket
- Mapper: Creates a document containing the key
associated with the record that you want to update.
- REST Post: Updates the ticket with the specified
attachments.
You configure these Snaps as explained in the sections below:
-
Configure the File Reader Snap to read a JSON file from the SnapLogic File
System:
Once the pipeline is validated, you can view the output of the File
Reader:
-
Configure the JSON Parser Snap to read the structure of the JSON file:
Once the pipeline validates successfully, you can view the output of the JSON
Parser Snap:
-
Configure the Mapper Snap to map fields for Jira ticket creation
You now need to add the details required to specify where the ticket must be created, and to whom it must be assigned. You do this using the Mapper Snap. The Mapper Snap maps the schema of the source document (the JSON Parser Snap's output) with the schema of the target document (the schema of a Jira ticket as propagated backward by the JIRA Create Snap).
Once fields from the input document are mapped to fields in the Jira ticket schema and the Pipeline is validated, you can view a preview of the output:
-
Use the JIRA Create Snap to create the Jira ticket
You now have a document containing all the details that you need to create a Jira ticket, and you use the JIRA Create Snap to create the ticket:
Once the ticket is created successfully, you can view the output in the preview:
-
Configure the Mapper Snap to isolate the Jira ticket ID
You just created a Jira ticket, and you can see the ticket ID displayed against the $key field in the output preview of the JIRA Create Snap. You can now add attachments to this ticket. You decide to add two images. To do so, you use the Mapper and REST Post Snaps.
Configure the Mapper Snap to isolate the Jira ticket number from the output of the JIRA Create Snap:
Once you validate the pipeline with your latest changes, you can see the
output preview of the Mapper Snap, and you can see that only the ticket ID
is retained:
-
Configure the REST Post Snap to upload attachments
You configure the REST Post Snap to upload two images as attachments to the identified Jira ticket, accessible through a Service URL:
For a successful upload, the REST Post Snap displays a status code of 200:
You have now successfully created a Jira ticket and added attachments to the ticket.