How can I publish an artifact
Asked by Serhii-S.Divnych:

Hi.

I try to us this dock <https://support.atlassian.com/bitbucket-cloud/docs/deploy-build-artifacts-to-bitbucket-downloads/>

I am unable to use pipe: atlassian/bitbucket-upload-file:0.3.2 (it is not working)

I am trying to use curl below with my variables

curl -X POST "https://${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}@api.bitbucket.org/2.0/repositories/${BITBUCKET_REPO_OWNER}/${BITBUCKET_REPO_SLUG}/downloads" --form files=@"app/build/outputs/apk/debug/application.apk"

How it looks in BB pipelines below:

<br />

+ pwsh -noprofile -Command { curl -X POST "https://${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD}@api.bitbucket.org/2.0/repositories/\*\*\*/\*\*\*/downloads" --form files=@"\*\*\*" }  
% Total % Received % Xferd Average Speed Time Time Time Current  
Dload Upload Total Spent Left Speed  
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0  
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0  
100 5110 0 0 100 5110 0 8604 --:--:-- --:--:-- --:--:-- 8617

Please help me understand if the file was uploaded and if so where?

There is nothing in the download section

PS. all steps is green


Answers:
author: Ben
body: G'day Serhii,

Welcome to the Bitbucket Cloud Community!

The reason the step is likely completed is that the cURL command has been sent but has not necessarily been processed correctly.

The format of the command you have provided looks slightly incorrect - can you please try the following format as below in a local terminal to see if it completes?

```
curl -X POST --user username:AppPassword https://api.bitbucket.org/2.0/repositories/workspaceID/repositoryslug/downloads -F files=@pathtofile.extension?
```

Once that is done, try the command above in Bitbucket Cloud pipelines.

Depending on your OS (ie Mac/Linux/Windows) - you will need the " " characters for the path on Windows - other OS does not require these and will often result in the command failing. I would recommend not using " " in Bitbucket Cloud Pipelines in general, but try with and without.

The files should be present in the left-hand sidebar of the repository under the "Downloads" heading.

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: Serhii-S.Divnych
body: HI, [@Ben](/t5/user/viewprofilepage/user-id/4537226) Thanks for your answer

It does not help.

I try with quotes and without quotes and get no result (

```
+ pwsh -noprofile -Command { 
curl -X POST --user ${BITBUCKET_USERNAME}:${BITBUCKET_APP_PASSWORD} https://api.bitbucket.org/2.0/repositories/workspaceID/repositoryslug/downloads 
-F files=@"analytics\DWH\bin\Debug\db.dacpac" 
}
```

It might not work with pseudo paths?

But on the other hand, I cannot change the execution directory of this command, and it is always executed from the root  
Best regards

Serhii


author: Ben
body: Hey Serhii,

Unfortunately, I'm not familiar with executing cURL via powershell commands. The cURL command I provided works on my end to upload files and should work as well on your end (assuming you are entering the BITBUCKET_USERNAME and BITBUCKET_APP_PASSWORD) in plaintext to pass this information through like I have done in my testing.  
It would either be the path or the credentials causing the issue, I recommend looking at our documentation related to this:  
**<https://developer.atlassian.com/cloud/bitbucket/rest/api-group-downloads/#api-repositories-workspace-repo-slug-downloads-post>**

Cheers!

- Ben (Bitbucket Cloud Support)


author: Serhii-S.Divnych
body: I already understand how to use curl request

```
curl -X POST --user username:AppPassword https://api.bitbucket.org/2.0/repositories/workspaceID/repositoryslug/downloads -F files=@pathtofile.extension?
```

Where username - it is your user name (not app username)

It doesn't make sense to me, but that's how it is.

Thanks for help [@Ben](/t5/user/viewprofilepage/user-id/4537226)


author: o_kyrdan
body: Hi [@Serhii-S.Divnych](/t5/user/viewprofilepage/user-id/4860155)

Could you provide us with more details why you unable to use [atlassian/bitbucket-upload-file](https://bitbucket.org/atlassian/bitbucket-upload-file) pipe?

Best regards,  
Oleksandr Kyrdan


Tags: bitbucket-cloud

bitbucket-pipelines

cloud

powershell