Quickstart

This guide will get you all set up and ready to use the Mainframe API. We'll cover how to authenticate and make your first API request to retrieve your profile. We'll also look at where to go next to find all the information you need to take full advantage of the API.

Authenticating

First, obtain a CSRF cookie, then log in with your credentials:

POST
/login
# Step 1: Get CSRF cookie
curl -X GET https://your-domain.com/sanctum/csrf-cookie \
  -H "Accept: application/json" \
  --cookie-jar cookies.txt

# Step 2: Login
curl -X POST https://your-domain.com/login \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Requested-With: XMLHttpRequest" \
  -H "X-XSRF-TOKEN: {xsrf_token}" \
  --cookie cookies.txt \
  --cookie-jar cookies.txt \
  -d '{"username": "admin", "password": "password"}'

Making your first API request

After authenticating, you are ready to make your first call to the Mainframe API. Below, you can see how to send a GET request to the profile endpoint to retrieve the currently authenticated user.

GET
/api/profile
curl https://your-domain.com/api/profile \
  -H "Accept: application/json" \
  -H "X-XSRF-TOKEN: {xsrf_token}" \
  --cookie cookies.txt

What's next?

Great, you're now authenticated and have made your first request to the API. Here are a few links that might be handy as you venture further into the Mainframe API:

Was this page helpful?