import os
import requests
url = "https://api.linear.app/graphql"
headers = {
"Authorization": f"Bearer {os.environ['LINEAR_API_KEY']}",
"Content-Type": "application/json"
}
data = {"query": "mutation {deleteIssue(id: \"issue-id\") {success}}"}
response = requests.delete(url, headers=headers, json=data)
if response.status_code >= 400:
print(response.text)
import os
import httpx
url = "https://api.linear.app/graphql"
headers = {
"Authorization": f"Bearer {os.environ['LINEAR_API_KEY']}",
"Content-Type": "application/json"
}
data = {"query": "mutation {deleteIssue(id: \"issue-id\") {success}}"}
with httpx.Client() as client:
response = client.delete(url, headers=headers, json=data)
if response.status_code >= 400:
print(response.text)
import fetch from 'node-fetch';
import { config } from 'dotenv';
config();
const url = 'https://api.linear.app/graphql';
const headers = {
'Authorization': `Bearer ${process.env.LINEAR_API_KEY}`,
'Content-Type': 'application/json'
};
const data = { query: 'mutation {deleteIssue(id: "issue-id") {success}}' };
fetch(url, {
method: 'DELETE',
headers,
body: JSON.stringify(data)
})
.then(res => {
if (res.status >= 400) {
return res.text();
}
})
.then(console.log);
import axios from 'axios';
import { config } from 'dotenv';
config();
const url = 'https://api.linear.app/graphql';
const headers = {
'Authorization': `Bearer ${process.env.LINEAR_API_KEY}`,
'Content-Type': 'application/json'
};
const data = { query: 'mutation {deleteIssue(id: "issue-id") {success}}' };
axios.delete(url, { headers, data })
.then(res => {
if (res.status >= 400) {
console.log(res.data);
}
})
.catch(console.error);
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
func main() {
url := "https://api.linear.app/graphql"
apiKey := os.Getenv("LINEAR_API_KEY")
if apiKey == "" {
log.Fatal("LINEAR_API_KEY environment variable not set")
}
req, err := http.NewRequest("DELETE", url, nil)
if err != nil {
log.Fatal(err)
}
req.Header.Set("Authorization", "Bearer "+apiKey)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
if resp.StatusCode >= 400 {
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
}
<?php
$url = 'https://api.linear.app/graphql';
$apiKey = getenv('LINEAR_API_KEY');
if (empty($apiKey)) {
die('LINEAR_API_KEY environment variable not set');
}
$headers = [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
];
$data = ['query' => 'mutation {deleteIssue(id: "issue-id") {success}}'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) {
echo $response;
}
curl_close($ch);
require 'net/http'
require 'json'
require 'uri'
url = URI.parse('https://api.linear.app/graphql')
api_key = ENV.fetch('LINEAR_API_KEY')
headers = {
'Authorization' => "Bearer #{api_key}",
'Content-Type' => 'application/json'
}
data = { query: 'mutation {deleteIssue(id: "issue-id") {success}}' }
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url.request_uri, headers)
request.body = data.to_json
response = http.request(request)
if response.code.to_i >= 400
puts response.body
end
import Foundation
let url = URL(string: "https://api.linear.app/graphql")!
var request = URLRequest(url: url)
request.httpMethod = "DELETE"
request.setValue("Bearer \(ProcessInfo.processInfo.environment["LINEAR_API_KEY"] ?? "")", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body: [String: Any] = ["query": "mutation {deleteIssue(id: \"issue-id\") {success}}"]
request.httpBody = try? JSONSerialization.data(withJSONObject: body)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print(error)
return
}
guard let httpResponse = response as? HTTPURLResponse,
httpResponse.statusCode >= 400 else { return }
if let data = data, let body = String(data: data, encoding: .utf8) {
print(body)
}
}
task.resume()
use reqwest::blocking::Client;
use std::env;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let url = "https://api.linear.app/graphql";
let api_key = env::var("LINEAR_API_KEY")?;
let client = Client::new();
let response = client
.delete(url)
.header("Authorization", format!("Bearer {}", api_key))
.header("Content-Type", "application/json")
.json(&serde_json::json!({"query": "mutation {deleteIssue(id: \"issue-id\") {success}}"}))
.send()?;
if response.status().as_u16() >= 400 {
println!("{}", response.text()?);
}
Ok(())
}
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var url = "https://api.linear.app/graphql";
var apiKey = Environment.GetEnvironmentVariable("LINEAR_API_KEY");
if (string.IsNullOrEmpty(apiKey))
{
Console.WriteLine("LINEAR_API_KEY environment variable not set");
return;
}
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var body = new { query = "mutation {deleteIssue(id: \"issue-id\") {success}}" };
var response = await client.DeleteAsync(url, new StringContent(System.Text.Json.JsonSerializer.Serialize(body)));
if (!response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
}
}
}