User:Kim/Stations, Skills, Resources/Git API: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
Line 10: Line 10:
this works for a simple fetch request in js (important are the origin: '*' to prevent CORS
this works for a simple fetch request in js (important are the origin: '*' to prevent CORS
  const url = 'https://gitlab.com/api/v4/projects/69537327/repository/commits';
  const url = 'https://gitlab.com/api/v4/projects/69537327/repository/commits';
        fetch(url, {
fetch(url, {
            method: 'GET',
    method: 'GET',
            origin: '*',
    origin: '*',
            headers: {
    headers: {
                'PRIVATE-TOKEN': 'glpat-D2WBV-9pNPVVfPyaOECS8m86MQp1Omc5b242Cw.01.121amvsln',
        'PRIVATE-TOKEN': 'glpat-D2WBV-9pNPVVfPyaOECS8m86MQp1Omc5b242Cw.01.121amvsln',
                'Content-Type': 'application/json',
        'Content-Type': 'application/json',
            },
      },
        })
})

Revision as of 17:11, 9 September 2025

scheming around with the Git API
can I use this to transform my personal reader into a (print / web to print) publication?

terminal

these worked:
curl --header "PRIVATE-TOKEN: <your_personal_access_token>" https://gitlab.com/api/v4/projects
curl --header "PRIVATE-TOKEN: <your_personal_access_token>" https://gitlab.com/api/v4/user

web (js)

this works for a simple fetch request in js (important are the origin: '*' to prevent CORS

const url = 'https://gitlab.com/api/v4/projects/69537327/repository/commits';
fetch(url, {
    method: 'GET',
    origin: '*',
    headers: {
        'PRIVATE-TOKEN': 'glpat-D2WBV-9pNPVVfPyaOECS8m86MQp1Omc5b242Cw.01.121amvsln',
        'Content-Type': 'application/json',
     },
})