Creating APIs with SnapLogic Pipelines and Ultra Tasks
Overview API (Application Program Interface) is an old concept repurposed to mean a modern web service based on the REST protocol and increasingly using the JSON data format. These modern APIs have become the franca lingua of the digital economy, by facilitating lightweight, performant communication between applications across an enterprise or across the internet. Typically RESTful APIs perform operations on “resources” (Customers, Orders, People, etc). By convention, the type of operation is identified using the most common HTTP verbs such as POST (create), GET (read), PUT (update), DELETE SnapLogic provides Ultra Tasks as the means by which a Pipeline can be exposed as a secure, high-availability, low-latency, sub-second request/response API. For example, the following is a Pipeline that embodies a Customer API exposed using an Ultra Task: Once the Ultra Task is enabled, the associated Pipeline stays resident in memory on the Snaplex node(s) it was configured to execute on. The number or Instances can be configured to accomodate the expected concurrent API request volume. The API can then be called securely from an external application (Postman REST client in this case): This is an example of an API GET (read) request for a specific Customer identified by the ID “1001” Designing the Pipeline Ultra Tasks deliver the components of the HTTP request message to its associated Pipeline as fields in the JSON document: content: The request body for POST or PUT requests headers: For example, the ‘User-Agent’ HTTP header can be referenced in the input document as $[‘user-agent’] uri: The original URI of the request. method: The HTTP request method. query: The parsed version of the query string. The value of this field will be an object whose fields correspond to query string parameters and a list of all the values for that parameter. For example, the following query string: foo=bar&foo=baz&one=1 Will result in a query object that looks like: { "foo" : ["bar", "baz"], "one": ["1"] } task_name: The name of the Ultra task. path_info: The part of the path after the Ultra task URL. server_ip: The IP address of the feed-master that received the request. server_port: The TCP port of the feed-master that received the request. client_ip: The IP address of the client that sent the request. client_port: The TCP port of the client that sent the request. In the above Customer API example: A Mapper Snap is used to parse the ID from the portion of the URL after the base path provided by the Ultra Task (demo-fm.snaplogic.io/api/1/rest/feed-master/queue/MyOrg/MyProjectSpace/API/Customers)… In this case “/1001”: A Router Snap is used to conditionally direct execution to the appropriate subflows designed in accordance with the RESTful CRUD operations described above: Additional Reference https://en.wikipedia.org/wiki/Representational_state_transfer http://doc.snaplogic.com/ultra-tasks13KViews1like5CommentsMigration form one org to another using SL Migration Pipelines
Hi All, I’m trying to automate the process of migrating a pipeline, task and account to one org to other org using the SL out of the box-Migration Pipelines. The issue I’m facing here is, when the migration is done from one org to other, I’ve to explicitly give the account reference for each of the pipelines where the account has been mentioned. Is there any way to automate this too? or are there any SL API available? please help 🙂6.4KViews0likes5CommentsGet Snap Task 401 (Unauthorized) Error
Hi, Hoping someone can offer some advice around this for me. Problem: I have a snap pipeline set up as a task in our environment, when called with a param it will return some json data around customer information. I can test this via postman with cloud and locally on my machine with the browser using both urls (on prem and cloud). However when using my web application (React) and using fetch() - I’m getting the 401 (Unauthorized) error in the console. Should i be using Basic Auth or the Bearer Token? Both of which seemed to be failing and nothing under in the headers (inspected the network tab in dev tools) Preview of my code making the request fetch(url, { mode: 'no-cors', headers: new Headers({ "Authorization": `Basic ${base64.encode(`${login}:${password}`)}` }), }) Any help would be greatly appreciated thanks. Regards Rich5.1KViews0likes3CommentsUnable to handle echo message
Hi all, I’m encountering this error for the first time but we have a ultra task api pipeline running. And today when Iwas testing out the api it gave the error message: Somehow knows what that means. I also saw in the dashboard that we sometime lose connection to the nodes so I found on the community. Lost contact with Snaplex node Designing Pipelines I have a very small pipeline (3 snaps) that I’m reading from a SQL table and writing the results to a new table in the same DB. I keep getting an error: Lost contact with Snaplex node while the pipeline was running. The select statement is pulling 250+M records and I’m using the Azure bulk insert to write. In order to avoid this error I keep having to reduce the batch size, from 20K to 10K to now 8K. Any thoughts on what could be causing the error? But i already have implemented a pipeline execute. and the CPU usage is very low someone knows the first error? Regards JensSolved4.5KViews0likes5CommentsIntegrating with REST APIs + OAuth when no native Snap is available
Hi, I’m looking into some API integrations with some services that are not supported by native snaps, but do offer a rich REST API and support OAuth. The wiki docs on the REST Snap have some details but its a quite daunting process to try and blindly hook up the OAuth2 steps and get the account working in a pipeline. Maybe I’m being lazy, but arent there any walkthrus or has someone done this before and willing to share how to set up integration with: Domo Microsoft Graph API (for Azure AD) Maybe even ElasticSearch Thanks, Mike4.1KViews1like3CommentsUploading Photo using Microsoft Graph API
I am trying to upload photo on O365 using Graph API. As per this document, I have to upload file as binary attachment and using Postman, I am able to update the photo. But in SnapLogic Rest Patch Snap, it is not working as intended. I have photo stored in SnapLogic project space as .jpeg file. Please let me know how can I use binary file with Rest Patch Snap.3.9KViews0likes2CommentsAPI capture POST/PUT content
Hi, I was wondering how to capture the content of a PUT/POST call to update/insert the data into a database. I know how to capture the URL through pipeline paramters (PATH_INFO) to make all my GET requests working but now I’m trying to find a way to capture the content of the PUT/POSt method. I have searched for pipeline parameters but only found QUERY_STRING and it doesn’t capture the content. Anyone knows a solution to this? Regards JensSolved3.7KViews0likes2CommentsAPI responses not working
Hello, So I created an API specification with these error responses. ‘400’: description: Bad request. ID must be an integer ‘401’: description: Authorization information is missing or invalid headers: {} content: {} ‘404’: description: Not found ‘500’: description: Interal server error (500) When I uploaded the spec into snaplogic and changed the pipeline I want it to fetch data from SQL server select with given ID. I want to reroute the error when the ID is not found. But when I do that I still get on the API call the Server error 500 form the snap itself of snaplogic and not from the reroute or from the specification defined error response Does someone know why it does not reroute the error to my custom error view or the response code from my api specificationSolved3.7KViews1like4CommentsGetting Internal Server Error (500) while making Post call to REST API using REST POST Snap- XML Payload
I am trying to post XML payload to a REST API using REST POST Snap but getting Internal Server Error (500) as response. I am also using Basic Authentication REST account in the REST Snap for authentication purpose. However, Using Postman I am getting 200 OK as response. Screenshot of pipeline: Pipeline Export: test_2019_12_07.slp (8.2 KB) Please help.3.5KViews0likes1Comment