Advice building a Bitbucket workflow

This topic was automatically generated from Slack. You can find the original thread here.

Celia McMahon : Hi there! I’m a little (really WAY) out of my depth on this one, but I am interested in being able to access a bitbucket repository and retrieve all the data from files that are located within that (these are .rdl files from Microsoft Report Builder). Basically, I would want the file names, and then from each file name dig in further to get the actual data (these all have their own unique url available to them).

The idea is to be able to create a report about all the reports we have that shows people what fields have been used, parameters etc, so that when someone goes to create a new report they don’t necessarily reinvent the wheel and can see all this info in a nice handy spot. I have looked at all the info I can find on this and have connected my bitbucket using the auths object. This event appears to be triggered by me adding a commit to the repository and that seems to be working fine. I’m getting the following error though and am sure I am not doing this correctly but wondered if you had any articles that had a bit more guidance on how this would all work (sorry I’m a junior developer and trying to get a crazy idea I had off the ground)

This is the error

ErrorRequest failed with status code 401
at null.createError (/tmp/ee/node_modules/axios/lib/core/createError.js:16:15)
at null.settle (/tmp/ee/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/tmp/ee/node_modules/axios/lib/adapters/http.js:260:11)
at IncomingMessage.emit (events.js:327:22)
at null.endReadableNT (internal/streams/readable.js:1327:12)
at process.processTicksAndRejections (internal/process/task_queues.js:80:21)
No return values or exportsfor this step

This is my code after the auth in steps.getData

Dylan Sather (Pipedream) : a 401 error suggests that the endpoint requires authentication of some sort that you’re not passing. That might make sense in this context if the repo you’re trying to access is private, since you need to pass credentials to fetch the data at that URL.

I’d recommend looking into the Bitbucket API more. I believe that will allow you to list files matching your criteria in the repo and fetch their contents. We provide a Bitbucket integration, so you can authorize Pipedream’s access to your Bitbucket account, and we’ll generate and pass the OAuth access token for you. You can see in that sample workflow how the Authorization header authenticates you with Bitbucket in that example.

Let me know if that helps!

Celia McMahon : hey thanks I will give it a try. I had done the integration to my account but it was still not working, will give this a go instead :smile: