Jenkins.NET icon indicating copy to clipboard operation
Jenkins.NET copied to clipboard

Please add more documentation details / examples

Open mr2001 opened this issue 4 years ago • 1 comments

Hello,

I am trying to download a file from Jenkins. The authentication part, using the API token works correctly. However, I constantly get "error 404 not found" when trying to download a file. Do I have to specify the full path to the file? If yes, then what is the correct format? Is this a web address? Is the job name also an URL?

This is the code that fails: ` Using stream = client.Artifacts.[Get]("Req_Test", 156, "AllPlot.xml") '<-- ERROR HERE

  Using reader = New StreamReader(stream)
    Dim rawresp As String
    rawresp = reader.ReadToEnd()
  End Using
End Using`

Error is: JenkinsNET.Exceptions.JenkinsArtifactGetException: 'Failed to retrieve artifact 'AllPlot.xml'!' WebException: The remote server returned an error: (404) Not Found.

Can you please advise? Would be useful to include some example in the Wiki.

Thank you for your help, Regards, M. Rusu

mr2001 avatar Mar 11 '20 17:03 mr2001

I got it working by specifying both the path to the job and the path to the file, something like:

` Using stream = client.Artifacts.[Get]("QC_Dashboard/job/MLS_Req_Test", 156, "hw_traceability/artifacts/hw_traceability.json")

  Using reader = New StreamReader(stream)
    Dim rawresp As String
    rawresp = reader.ReadToEnd()
  End Using
End Using `

mr2001 avatar Mar 11 '20 18:03 mr2001