[INFO] fetching crate jirav2 0.0.1... [INFO] documenting jirav2-0.0.1 against master#8afe9ff1caa97654c31fb8c259dac9fdf67d6302 for pr-151918-2 [INFO] extracting crate jirav2 0.0.1 into /workspace/builds/worker-1-tc1/source [INFO] started tweaking crates.io crate jirav2 0.0.1 [INFO] finished tweaking crates.io crate jirav2 0.0.1 [INFO] tweaked toml for crates.io crate jirav2 0.0.1 written to /workspace/builds/worker-1-tc1/source/Cargo.toml [INFO] validating manifest of crates.io crate jirav2 0.0.1 on toolchain 8afe9ff1caa97654c31fb8c259dac9fdf67d6302 [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+8afe9ff1caa97654c31fb8c259dac9fdf67d6302" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }` [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+8afe9ff1caa97654c31fb8c259dac9fdf67d6302" "generate-lockfile" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] [stderr] Updating crates.io index [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] [stderr] Locking 175 packages to latest compatible versions [INFO] [stderr] Adding reqwest v0.11.27 (available: v0.13.2) [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+8afe9ff1caa97654c31fb8c259dac9fdf67d6302" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] [stderr] Blocking waiting for file lock on package cache [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:61361fe0aef631f17e9d025a70c5a647956f8c671dd02950a60ad3f5cc5526d7" "/opt/rustwide/cargo-home/bin/cargo" "+8afe9ff1caa97654c31fb8c259dac9fdf67d6302" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 2ad3144d97c72be9b4cb487f846b03025814d8f304b12f395d78fd17cf5ee425 [INFO] running `Command { std: "docker" "start" "-a" "2ad3144d97c72be9b4cb487f846b03025814d8f304b12f395d78fd17cf5ee425", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "2ad3144d97c72be9b4cb487f846b03025814d8f304b12f395d78fd17cf5ee425", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "2ad3144d97c72be9b4cb487f846b03025814d8f304b12f395d78fd17cf5ee425", kill_on_drop: false }` [INFO] [stdout] 2ad3144d97c72be9b4cb487f846b03025814d8f304b12f395d78fd17cf5ee425 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:61361fe0aef631f17e9d025a70c5a647956f8c671dd02950a60ad3f5cc5526d7" "/opt/rustwide/cargo-home/bin/cargo" "+8afe9ff1caa97654c31fb8c259dac9fdf67d6302" "doc" "--frozen" "--no-deps" "--document-private-items" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 2252c8ad6da2fab6c0cbd1703c8494b7c274b519c2bc868c3a6006a25d9573b1 [INFO] running `Command { std: "docker" "start" "-a" "2252c8ad6da2fab6c0cbd1703c8494b7c274b519c2bc868c3a6006a25d9573b1", kill_on_drop: false }` [INFO] [stderr] Compiling libc v0.2.181 [INFO] [stderr] Compiling find-msvc-tools v0.1.9 [INFO] [stderr] Compiling proc-macro2 v1.0.106 [INFO] [stderr] Checking bytes v1.11.1 [INFO] [stderr] Compiling serde_core v1.0.228 [INFO] [stderr] Checking bitflags v2.10.0 [INFO] [stderr] Checking futures-task v0.3.31 [INFO] [stderr] Checking smallvec v1.15.1 [INFO] [stderr] Checking futures-util v0.3.31 [INFO] [stderr] Checking tracing v0.1.44 [INFO] [stderr] Compiling unicase v2.9.0 [INFO] [stderr] Compiling cc v1.2.55 [INFO] [stderr] Checking slab v0.4.12 [INFO] [stderr] Compiling serde v1.0.228 [INFO] [stderr] Compiling zmij v1.0.20 [INFO] [stderr] Compiling mime_guess v2.0.5 [INFO] [stderr] Checking http v0.2.12 [INFO] [stderr] Compiling quote v1.0.44 [INFO] [stderr] Compiling syn v2.0.114 [INFO] [stderr] Checking futures-channel v0.3.31 [INFO] [stderr] Checking ryu v1.0.23 [INFO] [stderr] Checking memchr v2.8.0 [INFO] [stderr] Checking http-body v0.4.6 [INFO] [stderr] Checking rustls-pemfile v1.0.4 [INFO] [stderr] Checking sync_wrapper v0.1.2 [INFO] [stderr] Checking mio v1.1.1 [INFO] [stderr] Checking socket2 v0.6.2 [INFO] [stderr] Checking socket2 v0.5.10 [INFO] [stderr] Compiling openssl-sys v0.9.111 [INFO] [stderr] Checking tokio v1.49.0 [INFO] [stderr] Compiling openssl v0.10.75 [INFO] [stderr] Compiling native-tls v0.2.14 [INFO] [stderr] Checking serde_json v1.0.149 [INFO] [stderr] Checking serde_urlencoded v0.7.1 [INFO] [stderr] Compiling synstructure v0.13.2 [INFO] [stderr] Compiling zerofrom-derive v0.1.6 [INFO] [stderr] Compiling yoke-derive v0.8.1 [INFO] [stderr] Compiling zerovec-derive v0.11.2 [INFO] [stderr] Compiling displaydoc v0.2.5 [INFO] [stderr] Compiling openssl-macros v0.1.1 [INFO] [stderr] Compiling serde_derive v1.0.228 [INFO] [stderr] Checking tokio-util v0.7.18 [INFO] [stderr] Checking h2 v0.3.27 [INFO] [stderr] Checking zerofrom v0.1.6 [INFO] [stderr] Checking yoke v0.8.1 [INFO] [stderr] Checking zerovec v0.11.5 [INFO] [stderr] Checking zerotrie v0.2.3 [INFO] [stderr] Checking tinystr v0.8.2 [INFO] [stderr] Checking potential_utf v0.1.4 [INFO] [stderr] Checking icu_locale_core v2.1.1 [INFO] [stderr] Checking icu_collections v2.1.1 [INFO] [stderr] Checking icu_provider v2.1.1 [INFO] [stderr] Checking icu_properties v2.1.2 [INFO] [stderr] Checking icu_normalizer v2.1.1 [INFO] [stderr] Checking hyper v0.14.32 [INFO] [stderr] Checking tokio-native-tls v0.3.1 [INFO] [stderr] Checking idna_adapter v1.2.1 [INFO] [stderr] Checking idna v1.1.0 [INFO] [stderr] Checking url v2.5.8 [INFO] [stderr] Checking hyper-tls v0.5.0 [INFO] [stderr] Checking reqwest v0.11.27 [INFO] [stderr] Documenting jirav2 v0.0.1 (/opt/rustwide/workdir) [INFO] [stdout] warning: variant `Not_Equal` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:43:5 [INFO] [stdout] | [INFO] [stdout] 43 | Not_Equal, [INFO] [stdout] | ^^^^^^^^^ help: convert the identifier to upper camel case: `NotEqual` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Greater_Than` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:45:5 [INFO] [stdout] | [INFO] [stdout] 45 | Greater_Than, [INFO] [stdout] | ^^^^^^^^^^^^ help: convert the identifier to upper camel case: `GreaterThan` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Less_Than` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:47:5 [INFO] [stdout] | [INFO] [stdout] 47 | Less_Than, [INFO] [stdout] | ^^^^^^^^^ help: convert the identifier to upper camel case: `LessThan` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Greater_Than_Or_Equal_To` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:49:5 [INFO] [stdout] | [INFO] [stdout] 49 | Greater_Than_Or_Equal_To, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `GreaterThanOrEqualTo` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Less_Than_Or_Equal_To` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:51:5 [INFO] [stdout] | [INFO] [stdout] 51 | Less_Than_Or_Equal_To, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `LessThanOrEqualTo` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Tilde_Equal` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:59:5 [INFO] [stdout] | [INFO] [stdout] 59 | Tilde_Equal, [INFO] [stdout] | ^^^^^^^^^^^ help: convert the identifier to upper camel case: `TildeEqual` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unresolved link to `em>` [INFO] [stdout] --> src/models/search_request_bean.rs:31:22 [INFO] [stdout] | [INFO] [stdout] 31 | /// Use [expand](em>#expansion) to include additional information about issues in the response. Note that, unlike the majority o... [INFO] [stdout] | ^^^^^^^^^^^^^ unbalanced angle brackets [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unresolved link to `em>` [INFO] [stdout] --> src/models/version.rs:17:22 [INFO] [stdout] | [INFO] [stdout] 17 | /// Use [expand](em>#expansion) to include additional information about version in the response. This parameter accepts a comma-... [INFO] [stdout] | ^^^^^^^^^^^^^ unbalanced angle brackets [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:548 [INFO] [stdout] | [INFO] [stdout] 227 | ... --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] = note: `#[warn(rustdoc::bare_urls)]` on by default [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST '' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:835 [INFO] [stdout] | [INFO] [stdout] 227 | ...e-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:884 [INFO] [stdout] | [INFO] [stdout] 227 | ...://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:1346 [INFO] [stdout] | [INFO] [stdout] 227 | ...InBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST',... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2077 [INFO] [stdout] | [INFO] [stdout] 227 | ... code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https:... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2149 [INFO] [stdout] | [INFO] [stdout] 227 | ...ttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2612 [INFO] [stdout] | [INFO] [stdout] 227 | ...code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth imp... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2745 [INFO] [stdout] | [INFO] [stdout] 227 | ...th import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:3429 [INFO] [stdout] | [INFO] [stdout] 227 | ...is code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', '... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:3760 [INFO] [stdout] | [INFO] [stdout] 227 | ...nse = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $he... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( '{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:4009 [INFO] [stdout] | [INFO] [stdout] 227 | ...ge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/fo... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:4065 [INFO] [stdout] | [INFO] [stdout] 227 | ...loper.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; im... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter.rs:35:93 [INFO] [stdout] | [INFO] [stdout] 35 | ... the ID of the filter. For example, *https://your-domain.atlassian.net/issues/?filter=10100*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 35 | /// A URL to view the filter results in Jira, using the ID of the filter. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter.rs:38:209 [INFO] [stdout] | [INFO] [stdout] 38 | ...ts. For example, *https://your-domain.atlassian.net/rest/api/2/search?jql=project+%3D+SSP+AND+issuetype+%3D+Bug*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 38 | /// A URL to view the filter results in Jira, using the [Search for issues using JQL](#api-rest-api-2-filter-search-get) operation with the filter's JQL string to return the filter results. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter_details.rs:38:93 [INFO] [stdout] | [INFO] [stdout] 38 | ... the ID of the filter. For example, *https://your-domain.atlassian.net/issues/?filter=10100*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 38 | /// A URL to view the filter results in Jira, using the ID of the filter. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter_details.rs:41:209 [INFO] [stdout] | [INFO] [stdout] 41 | ...ts. For example, *https://your-domain.atlassian.net/rest/api/2/search?jql=project+%3D+SSP+AND+issuetype+%3D+Bug*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 41 | /// A URL to view the filter results in Jira, using the [Search for issues using JQL](#api-rest-api-2-filter-search-get) operation with the filter's JQL string to return the filter results. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/issue_field_option_create_bean.rs:19:136 [INFO] [stdout] | [INFO] [stdout] 19 | ...extractions (see https://developer.atlassian.com/cloud/jira/platform/modules/issue-field-option-property-index/) are defined in t... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 19 | /// The properties of the option as arbitrary key-value pairs. These properties can be searched using JQL, if the extractions (see ) are defined in the descriptor for the issue field module. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 1m 00s [INFO] [stderr] Generated /opt/rustwide/target/doc/jirav2/index.html [INFO] running `Command { std: "docker" "inspect" "2252c8ad6da2fab6c0cbd1703c8494b7c274b519c2bc868c3a6006a25d9573b1", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "2252c8ad6da2fab6c0cbd1703c8494b7c274b519c2bc868c3a6006a25d9573b1", kill_on_drop: false }` [INFO] [stdout] 2252c8ad6da2fab6c0cbd1703c8494b7c274b519c2bc868c3a6006a25d9573b1 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "DOCS_RS=1" "-e" "RUSTC_BOOTSTRAP=1" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:61361fe0aef631f17e9d025a70c5a647956f8c671dd02950a60ad3f5cc5526d7" "/opt/rustwide/cargo-home/bin/cargo" "+8afe9ff1caa97654c31fb8c259dac9fdf67d6302" "rustdoc" "--lib" "-Zrustdoc-map" "--config" "build.rustdocflags=[\"--cfg\", \"docsrs\", \"-Z\", \"unstable-options\", \"--document-private-items\"]" "--frozen" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 6de26afe1e3f2203746f8a2f80be311c8e5fdac9a8c1a1476795c129a4c258c9 [INFO] running `Command { std: "docker" "start" "-a" "6de26afe1e3f2203746f8a2f80be311c8e5fdac9a8c1a1476795c129a4c258c9", kill_on_drop: false }` [INFO] [stderr] Documenting jirav2 v0.0.1 (/opt/rustwide/workdir) [INFO] [stdout] warning: variant `Not_Equal` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:43:5 [INFO] [stdout] | [INFO] [stdout] 43 | Not_Equal, [INFO] [stdout] | ^^^^^^^^^ help: convert the identifier to upper camel case: `NotEqual` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(non_camel_case_types)]` (part of `#[warn(nonstandard_style)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Greater_Than` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:45:5 [INFO] [stdout] | [INFO] [stdout] 45 | Greater_Than, [INFO] [stdout] | ^^^^^^^^^^^^ help: convert the identifier to upper camel case: `GreaterThan` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Less_Than` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:47:5 [INFO] [stdout] | [INFO] [stdout] 47 | Less_Than, [INFO] [stdout] | ^^^^^^^^^ help: convert the identifier to upper camel case: `LessThan` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Greater_Than_Or_Equal_To` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:49:5 [INFO] [stdout] | [INFO] [stdout] 49 | Greater_Than_Or_Equal_To, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `GreaterThanOrEqualTo` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Less_Than_Or_Equal_To` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:51:5 [INFO] [stdout] | [INFO] [stdout] 51 | Less_Than_Or_Equal_To, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `LessThanOrEqualTo` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Tilde_Equal` should have an upper camel case name [INFO] [stdout] --> src/models/field_value_clause.rs:59:5 [INFO] [stdout] | [INFO] [stdout] 59 | Tilde_Equal, [INFO] [stdout] | ^^^^^^^^^^^ help: convert the identifier to upper camel case: `TildeEqual` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unresolved link to `em>` [INFO] [stdout] --> src/models/search_request_bean.rs:31:22 [INFO] [stdout] | [INFO] [stdout] 31 | /// Use [expand](em>#expansion) to include additional information about issues in the response. Note that, unlike the majority o... [INFO] [stdout] | ^^^^^^^^^^^^^ unbalanced angle brackets [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unresolved link to `em>` [INFO] [stdout] --> src/models/version.rs:17:22 [INFO] [stdout] | [INFO] [stdout] 17 | /// Use [expand](em>#expansion) to include additional information about version in the response. This parameter accepts a comma-... [INFO] [stdout] | ^^^^^^^^^^^^^ unbalanced angle brackets [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:548 [INFO] [stdout] | [INFO] [stdout] 227 | ... --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] = note: `#[warn(rustdoc::bare_urls)]` on by default [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST '' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:835 [INFO] [stdout] | [INFO] [stdout] 227 | ...e-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:884 [INFO] [stdout] | [INFO] [stdout] 227 | ...://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:1346 [INFO] [stdout] | [INFO] [stdout] 227 | ...InBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST',... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2077 [INFO] [stdout] | [INFO] [stdout] 227 | ... code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https:... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2149 [INFO] [stdout] | [INFO] [stdout] 227 | ...ttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2612 [INFO] [stdout] | [INFO] [stdout] 227 | ...code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth imp... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:2745 [INFO] [stdout] | [INFO] [stdout] 227 | ...th import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:3429 [INFO] [stdout] | [INFO] [stdout] 227 | ...is code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', '... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:3760 [INFO] [stdout] | [INFO] [stdout] 227 | ...nse = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $he... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( '{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:4009 [INFO] [stdout] | [INFO] [stdout] 227 | ...ge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // https://www.npmjs.com/package/fo... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/apis/issue_attachments_api.rs:227:4065 [INFO] [stdout] | [INFO] [stdout] 227 | ...loper.atlassian.com/platform/forge/ // https://www.npmjs.com/package/form-data import api from \"@forge/api\"; im... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 227 | /// Adds one or more attachments to an issue. Attachments are posted as multipart/form-data ([RFC 1867](https://www.ietf.org/rfc/rfc1867.txt)). Note that: * The request must have a `X-Atlassian-Token: no-check` header, if not it is blocked. See [Special headers](#special-request-headers) for more information. * The name of the multipart/form-data parameter that contains the attachments must be `file`. The following examples upload a file called *myfile.txt* to the issue *TEST-123*: #### curl #### curl --location --request POST 'https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments' -u 'email@example.com:' -H 'X-Atlassian-Token: no-check' --form 'file=@\"myfile.txt\"' #### Node.js #### // This code sample uses the 'node-fetch' and 'form-data' libraries: // https://www.npmjs.com/package/node-fetch // https://www.npmjs.com/package/form-data const fetch = require('node-fetch'); const FormData = require('form-data'); const fs = require('fs'); const filePath = 'myfile.txt'; const form = new FormData(); const stats = fs.statSync(filePath); const fileSizeInBytes = stats.size; const fileStream = fs.createReadStream(filePath); form.append('file', fileStream, {knownLength: fileSizeInBytes}); fetch('https://your-domain.atlassian.net/rest/api/2/issue/TEST-123/attachments', { method: 'POST', body: form, headers: { 'Authorization': `Basic ${Buffer.from( 'email@example.com:' ).toString('base64')}`, 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }) .then(response => { console.log( `Response: ${response.status} ${response.statusText}` ); return response.text(); }) .then(text => console.log(text)) .catch(err => console.error(err)); #### Java #### // This code sample uses the 'Unirest' library: // http://unirest.io/java.html HttpResponse response = Unirest.post(\"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\") .basicAuth(\"email@example.com\", \"\") .header(\"Accept\", \"application/json\") .header(\"X-Atlassian-Token\", \"no-check\") .field(\"file\", new File(\"myfile.txt\")) .asJson(); System.out.println(response.getBody()); #### Python #### # This code sample uses the 'requests' library: # http://docs.python-requests.org import requests from requests.auth import HTTPBasicAuth import json url = \"https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments\" auth = HTTPBasicAuth(\"email@example.com\", \"\") headers = { \"Accept\": \"application/json\", \"X-Atlassian-Token\": \"no-check\" } response = requests.request( \"POST\", url, headers = headers, auth = auth, files = { \"file\": (\"myfile.txt\", open(\"myfile.txt\",\"rb\"), \"application-type\") } ) print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(\",\", \": \"))) #### PHP #### // This code sample uses the 'Unirest' library: // http://unirest.io/php.html Unirest\\Request::auth('email@example.com', ''); $headers = array( 'Accept' => 'application/json', 'X-Atlassian-Token' => 'no-check' ); $parameters = array( 'file' => File::add('myfile.txt') ); $response = Unirest\\Request::post( 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/attachments', $headers, $parameters ); var_dump($response) #### Forge #### // This sample uses Atlassian Forge and the `form-data` library. // https://developer.atlassian.com/platform/forge/ // import api from \"@forge/api\"; import FormData from \"form-data\"; const form = new FormData(); form.append('file', fileStream, {knownLength: fileSizeInBytes}); const response = await api.asApp().requestJira('/rest/api/2/issue/{issueIdOrKey}/attachments', { method: 'POST', body: form, headers: { 'Accept': 'application/json', 'X-Atlassian-Token': 'no-check' } }); console.log(`Response: ${response.status} ${response.statusText}`); console.log(await response.json()); Tip: Use a client library. Many client libraries have classes for handling multipart POST operations. For example, in Java, the Apache HTTP Components library provides a [MultiPartEntity](http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntity.html) class for multipart POST operations. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Create attachments* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter.rs:35:93 [INFO] [stdout] | [INFO] [stdout] 35 | ... the ID of the filter. For example, *https://your-domain.atlassian.net/issues/?filter=10100*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 35 | /// A URL to view the filter results in Jira, using the ID of the filter. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter.rs:38:209 [INFO] [stdout] | [INFO] [stdout] 38 | ...ts. For example, *https://your-domain.atlassian.net/rest/api/2/search?jql=project+%3D+SSP+AND+issuetype+%3D+Bug*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 38 | /// A URL to view the filter results in Jira, using the [Search for issues using JQL](#api-rest-api-2-filter-search-get) operation with the filter's JQL string to return the filter results. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter_details.rs:38:93 [INFO] [stdout] | [INFO] [stdout] 38 | ... the ID of the filter. For example, *https://your-domain.atlassian.net/issues/?filter=10100*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 38 | /// A URL to view the filter results in Jira, using the ID of the filter. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/filter_details.rs:41:209 [INFO] [stdout] | [INFO] [stdout] 41 | ...ts. For example, *https://your-domain.atlassian.net/rest/api/2/search?jql=project+%3D+SSP+AND+issuetype+%3D+Bug*. [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 41 | /// A URL to view the filter results in Jira, using the [Search for issues using JQL](#api-rest-api-2-filter-search-get) operation with the filter's JQL string to return the filter results. For example, **. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this URL is not a hyperlink [INFO] [stdout] --> src/models/issue_field_option_create_bean.rs:19:136 [INFO] [stdout] | [INFO] [stdout] 19 | ...extractions (see https://developer.atlassian.com/cloud/jira/platform/modules/issue-field-option-property-index/) are defined in t... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: bare URLs are not automatically turned into clickable links [INFO] [stdout] help: use an automatic link instead [INFO] [stdout] | [INFO] [stdout] 19 | /// The properties of the option as arbitrary key-value pairs. These properties can be searched using JQL, if the extractions (see ) are defined in the descriptor for the issue field module. [INFO] [stdout] | + + [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 16.05s [INFO] [stderr] Generated /opt/rustwide/target/doc/jirav2/index.html [INFO] running `Command { std: "docker" "inspect" "6de26afe1e3f2203746f8a2f80be311c8e5fdac9a8c1a1476795c129a4c258c9", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "6de26afe1e3f2203746f8a2f80be311c8e5fdac9a8c1a1476795c129a4c258c9", kill_on_drop: false }` [INFO] [stdout] 6de26afe1e3f2203746f8a2f80be311c8e5fdac9a8c1a1476795c129a4c258c9