Forum Discussion
So I’m persisting here!
I’ve gone down the route of adding a Salesforce Lookup Snap after a Salesforce Create one and although they are validated, the Lookup Snap isn’t passing the returned Id through to the Mapper:
Instead all I get is the URL, JobId and BatchId which is the output of the Salesforce Create Snap.
I know the Salesforce Lookup Snap works because I’ve been able to successfully return and map Id’s in previous Snaps:
The ‘Map Content’ Snap is to take the newly created record Id (a Parent record) and relate it to 6 documents (x6 Child records).
Any ideas?
Hi Rich:
You should be passing the generated bearer token for the task. Something like
Authorization: Bearer 9V9HGRt0m9BRgD42AZWpzC14QuYABCDE
Is this a triggered or Ultra task ?
- richard_griffit5 years agoNew Contributor
I had also tried that approach passing the
"Authorization" : "Bearer {token_value}"
But still receiving a 401. I did notice that the browser asked for my credentials where as postman didn’t. Hence why i tested with basic.
I am using a triggered task, unfortunately I’m not clued up on the Ultra Tasks - is this something i should be using in this scenario?
Thanks for your response
Regards
RichHi Rich:
A triggered task should be fine for what you’re doing. An Ultra pipeline/task runs constantly and is meant for real-time processing. You can read more about it here.
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438189/Triggered+Tasks
If you don’t supply a bearer token, then you need to supply your SnapLogic credentials. It sounds like neither is working you (that is, you’re getting a 401).
I’ve verified a simple triggered task using Curl and also a Java client. I assume the bearer token is valid and you have verified the authorization header is written into the request for your React app.
Here is curl request with a valid bearer token:
$ curl -verbose -X POST \ -H "Authorization: Bearer T3gwZuqhcc1no4ZBltrZi4XVTqiPwfdP" \ -H "Content-Type: application/json" \ -d '{"param1": "value"}' \ http://sm-mbp-mbowen:8888/api/1/rest/slsched/feed/snaplogic/projects/support/simple-task-1 REQUEST: > POST /api/1/rest/slsched/feed/snaplogic/projects/support/simple-task-1 HTTP/1.1 > Host: sm-mbp-mbowen:8888 > User-Agent: curl/7.54.0 > Accept: */* > Referer: rbose > Authorization: Bearer T3gwZuqhcc1no4ZBltrZi4XVTqiPwfdP > Content-Type: application/json > Content-Length: 19 RESPONSE: < HTTP/1.1 200 OK ... [ {"content":{"param1":"value"}} ]
A curl request with my SnapLogic credentials:
$ curl --user mbowen@snaplogic.com:<password> -verbose -X POST \ -H "Content-Type: application/json" \ -d '{"param1": "value"}' \ http://sm-mbp-mbowen:8888/api/1/rest/slsched/feed/snaplogic/projects/support/simple-task-1 REQUEST: > POST /api/1/rest/slsched/feed/snaplogic/projects/support/simple-task-1 HTTP/1.1 > Host: sm-mbp-mbowen:8888 > Authorization: Basic YWRtaW5Ac25hcGxvZ2ljLmNvbTpBZG0xbkAxMno= > User-Agent: curl/7.54.0 > Accept: */* > Referer: rbose > Content-Type: application/json > Content-Length: 19 RESPONSE: < HTTP/1.1 200 OK ... [ {"content":{"param1":"value"}} ]
I will get a 401 if either the token or credentials aren’t valid.
< HTTP/1.1 401 UNAUTHORIZED {"response_map": {"error_list": [{"message": "Authentication required"}]}, "http_status_code": 401}
It sounds like you are able to trigger the task via Postman, so you’re passing the right authentication bits. Is your browser configured to use a proxy? Seems something with the React app.
Related Content
- 3 years ago
- 10 months ago
- 4 years ago
- 2 years ago