Skip to content

It Seems I Was (20%) Wrong

About AI. It’s always enjoyable to poke fun at the nonsensical texts, bizarrely distorted depictions of human anatomy, confusing interactions of objects in space and, you know, all the tell-tale signs of AI generated crap. It’s less enjoyable to talk about the gigantic amounts of money (our money, by the way, just in case your 401(k) has wandered into that swamp) being wasted on development and natural resources.

But still there’s something that a monster created by programming geeks can do well, and that is answer questions about code.

For a lot of IT system work, the documentation is appalling. It’s often incorrect, out-of-date, incomplete, badly written, missing, or all of the above. I know I know, I’ve done coding too and sometimes it’s hard to remember even to put decent comments in.

But at the enterprise level of things, it’s a real problem. I spent weeks trying to sort out how the APIs for Atlassian/Jira worked. Like a lot of documentation is starts out at step 9 (or whatever) leaving you to figure out something basic like “How Does My Code Authenticate Against The API?”

Enter ChatGPT. I can ask it the fundamental question, “What is the most basic API connection to Atlassian JIRA using PHP?”, and it gives me back:

<?php
// JIRA API credentials
$jira_url = "https://yourcompany.atlassian.net/rest/api/3/issue/"; // Base URL for API
$issue_key = "TEST-1"; // Replace with an actual issue key
$email = "your-email@example.com"; // Your Atlassian account email
$api_token = "your-api-token"; // Your Atlassian API token
// Prepare API request
$url = $jira_url . $issue_key;
$auth = base64_encode("$email:$api_token");
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Basic $auth",
"Content-Type: application/json",
],
]);
// Execute request
$response = curl_exec($curl);
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
// Check response
if ($http_code == 200) {
$data = json_decode($response, true);
echo "<pre>";
print_r($data); // Output JIRA issue details
echo "</pre>";
} else {
echo "Error: Unable to connect to JIRA API (HTTP Code: $http_code)";
}
?>

Which is really easy to sort out and drop in to my PHP code. It’s even got the error checking built in. Honestly, and maybe it’s just me, but finding this stuff on the JIRA web site is finding a needle in 25 different haystacks.

It even comes with an explanation, and an example of the output you might expect.

It can also can clarify the terminology used. For example “issue” isn’t what you might think. It’s actually any “unit of work,” which could be a task, bug, story, epic (more inside terminology), or a sub-task. And it wrote me a cookbook. Really. One of my favorite series from O’Reilly publishing was their Cookbooks. Their “Perl Cookbook” was never far out of reach when I was coding a lot of Perl. Now I have a “Jira API Cookbook (PHP Edition).

I was also having problems with TinyMCE, the plugin that formatting options to a text area on a web form. Some things weren’t working, and as I inquired more deeply I got a list of:

  1. Your Realistic Options
  2. My Honest Advice (this made me laugh out loud)
  3. If You Want I Can Show You Right Now.

All of which was enlightening and even if not precisely correct and needed follow up, was close enough to get/keep me on the right track.

I just wish I had this when I was banging my head against the wall on Amazon Web Services.

Today I got access to the company account for CGPT, and also got turned on to Poe and blackbox.ai. We shall see.

 

 

 

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Share This