JSFiddle - React, Tailwind, and code Playground
by WILLIAM CORREA
HTML
<pre id="console"></pre>
JavaScript
// curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/4/issues?title=Issues%20with%20auth&labels=bug
// https://gitlab.com/api/v3/projects?private_token=9koXpg98eAheJpvBs5tK
const log = function (message) {
$('#console').html(message);
}
$.ajax({
method: 'POST',
url: 'https://gitlab.com/api/v3/projects/1545527/issues',
data: {
title: 'Issue created by API',
labels: 'bug'
},
beforeSend: function(xhr) {
xhr.setRequestHeader("PRIVATE-TOKEN", "9koXpg98eAheJpvBs5tK")
}, success: function(data) {
//process the JSON data etc
log(data);
}
});