Skip to content
FeedbackDashboard

Download build target output

$client->builds->targetOutputs->retrieve(string buildID, Target target, Type type, ?Output output, ?string path): TargetOutputGetResponse
GET/v0/build_target_outputs

Retrieve a method to download an output for a given build target.

If the requested type of output is source, and the requested output method is url, a download link to a tarball of the source files is returned. If the requested output method is git, a Git remote, ref, and access token (if necessary) is returned.

Otherwise, the possible types of outputs are specific to the requested target, and the output method must be url or content. See the documentation for type for more information.

The content output method returns the raw content of the output inline, instead of a download URL, and is only supported for the openapi-* and file types.

ParametersExpand Collapse
buildID: string

Build ID

target: Target

SDK language target name

type: Type
output?:optional Output

Output format: url (download URL), git (temporary access token), or content (raw content returned inline, only supported for the “openapi-*” and “file” types).

path?:optional string

The path of the file to get when used with “type”: “file”.

ReturnsExpand Collapse
One of the following:
URL
"url" output
Target target
Type type
string url

URL for direct download

?string path

The path of the file, which is only present when using with the type “file” option.

Git
string token

Temporary GitHub access token

"git" output
string ref

Git reference (commit SHA, branch, or tag)

Target target
Type type
string url

URL to git remote

Content
string content

The raw content of the output

"content" output
Target target
Type type
?string path

The path of the file, which is only present when using with the type “file” option.

Download build target output

<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

$client = new Client(apiKey: 'My API Key', environment: 'staging');

$targetOutput = $client->builds->targetOutputs->retrieve(
  buildID: 'build_id',
  target: 'node',
  type: 'source',
  output: 'url',
  path: 'path',
);

var_dump($targetOutput);
{
  "output": "url",
  "target": "node",
  "type": "source",
  "url": "url",
  "path": "path"
}
Returns Examples
{
  "output": "url",
  "target": "node",
  "type": "source",
  "url": "url",
  "path": "path"
}