cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to find incoming data format(json,xml) dynamically in pipeline input view?

Surendar
Contributor

How to find incoming data format dynamically?

Say for example,

  1. If the incoming data is JSON then I need to perform certain validation and flow for JSON
  2. If the incoming data is xml then I to perform certain operations.

Can any one suggest How to find incoming data format during the run-time. by using single input view for the pipeline?

6 REPLIES 6

slaytanic70
New Contributor III

Can the incoming request also send a parameter of โ€œfile_typeโ€? Then you could use a router based on this value to handle it as JSON or XML or any other file_type that is sent.

Yes we have done the same and found the solution for the above approach.
image

In binary router we are validating the JSON or XML input streams and then doing our further works.

Thanks for your attention.

We did the same, when we tested with a FIle Reader snap and specified a file from SLDB, we found that the field we need to check is โ€˜x-amz-meta-mimetypeโ€™. When we remove the File Reader snap, create a task and use postmanโ€ฆ the input does not have this field. We tried using content-type and this fails tooโ€ฆ Could you please provide what the conditions in the router were?

Do you mean a Triggered Task? The Content-Type header for a POST (and a few others) come in as pipeline parameters. To get the Content-Type, youโ€™d use:

_CONTENT_TYPE