You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Good day everyone, I have some questions and errors about using the Jira API for my WordPress website and I need your help on this
So I am building a WPForm in WordPress to take the data from the inputs and submit them with Jira API POST request to create a task on Jira. However, I encountered some errors when submitting the form. Below is the code
function sendingDataToJira( $fields, $entry, $form_data, $entry_id) {
$user = 'MY_USERNAME';
$token = 'MY_TOKEN';
$entry = wpforms()->entry->get( $entry_id );
$entry_fields = json_decode( $entry->fields, true);
if ($form_data['id'] == 3809) {
$api_url = 'https://MY_URL/rest/api/2/issue/';
$body = array (
'fields' => array (
'project'=> array (
'key'=> 'ATS',
),
'summary' => 'New Applicant',
'description' => 'null',
'customfield_10034' => $form_data[4]['value'],
'customfield_10035' => $form_data[5]['value'],
'issuetype' => array(
'name' => 'Task',
),
),
);
$request = wp_remote_post( $api_url, array(
'method' => 'POST',
'headers' => array(
'Authorization' => 'Basic' . base64_encode( $user . ':' . $token),
'Content-Type' => 'application/json'),
'body' => json_encode( $body ),
'data_format' => 'body'
) );
};
}
add_action( 'wpforms_process_complete', 'sendingDataToJira', 10, 4 );
And here are the errors
I will appreciate any support and replies, but keep in mind that I have to code it manually without being allowed to use any third parties.
Thank you in advance