cancel
Showing results for 
Search instead for 
Did you mean: 

Snaplogic Rest Post Snap: Failing with Invalid input JSON

snapation6713
New Contributor III

I have a Json Generator snap that contains the following snippet:

{ "filterGroups": [ { "filters": [ { "propertyName": "lastmodifieddate", "operator": "GT", "value":"2024-04-18T18:21:27.255Z" } ] } ] }

 

Then I have a mapper extracting the filterGroups object to pass to the RestPost snap. The Rest Post snap is configured as follows: 

snapation6713_1-1716554614979.png

I am getting the following error from the RestPost snap when trying to validate:  

"error_entity": "{"status":"error","message":"Invalid input JSON on line 1, column 3: Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value","correlationId":"8a0113b5-82ac-4e25-ae27-9380e01b3e5f"}" "request_headers": [ {...} ] "statusCode": 400 "snap_details": { "label":"REST Post","instance_id":"e9e63d7c-0606-401a-87d7-545e3a4a26d3","class_id":"com-snaplogic->snaps-rest-post","build_tag":"main25112","views":{...} } "original": { "content":{...} } } ]

The same exact content snippet works fine in Postman. I get back the correct data. I tried removing the 'T' and the 'Z' and different variations and it still fails with the same error message.  

Does anyone know how to resolve this?  

I will eventually need to pass the date value as a parameter.  If anyone can help me do that it would be great as well.

 

1 ACCEPTED SOLUTION

snapation6713
New Contributor III

This error message went away when I used parameters to pass the datetime.  I get the value from a query then I create the json using a script snap with this snippet:  


            // Set propertyName and value from pipeline properties
            filter.put("propertyName", $_dttmColumn);
            filter.put("operator""GT");
            filter.put("value", $_max_dttm);  
where max_dttm contains the datetime value.

View solution in original post

1 REPLY 1

snapation6713
New Contributor III

This error message went away when I used parameters to pass the datetime.  I get the value from a query then I create the json using a script snap with this snippet:  


            // Set propertyName and value from pipeline properties
            filter.put("propertyName", $_dttmColumn);
            filter.put("operator""GT");
            filter.put("value", $_max_dttm);  
where max_dttm contains the datetime value.