First API Call

After becoming a Partner and receiving your client_id and client_secret, you're ready to make your first API call. This initial step involves obtaining an access token using the client credentials grant type, which is essential for authenticating your subsequent API requests. Here's how you can make your first API call to the K12NET platform:

Step 1: Prepare Your Request

To obtain an access token, you need to make a POST request to the token endpoint with your client credentials. The endpoint you will use is:

    
        https://api.k12net.com/GWCore.Web/connect/token
    
    

Your request should include the following parameters in the body:

  • grant_type: This should be set to client_credentials.
  • client_id: Your unique identifier provided by K12NET.
  • client_secret: Your confidential key provided by K12NET.

Step 2: Execute the POST Request

You can use tools like Postman or write a simple script in your preferred programming language to make the POST request. Here's an example using cURL:


curl -X POST https://api.k12net.com/GWCore.Web/connect/token \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \
-H "Content-Type: application/x-www-form-urlencoded"

Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with the credentials provided to you.

Step 3: Receive the Access Token

If your request is successful, you'll receive a response containing the access_token along with its expiry information. The response will look something like this:

    
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_in": 3600,
  "token_type": "Bearer"
}
    
    

Step 4: Use the Access Token

With the access_token, you can authenticate your subsequent API requests to K12NET. Include it in the Authorization header as a Bearer token:

         
curl -X GET https://api.k12net.com/endpoint
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
         
    

Replace YOUR_ACCESS_TOKEN with the token you received and https://api.k12net.com/endpoint with the actual API endpoint you wish to call.

Congratulations! You've successfully made your first API call to K12NET. This is just the beginning of what you can achieve as a Partner. Explore our API documentation for more endpoints and functionalities to enhance your application or service.