GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BeazleyLabs/zapi_csharp: ZAPI CSharp example JWT generate and make call to zapi

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
.vs/ZapiCSharp/v14
.vs/ZapiCSharp/v14
 
 
ZapiCSharp
ZapiCSharp
 
 
README.md
README.md
 
 
ZapiCSharp.sln
ZapiCSharp.sln
 
 

Repository files navigation

zapi_csharp

ZAPI CSharp example JWT generate and make call to zapi

Define ZAPI Credentials (ZapiCSharp.cs) and API Information

//define userName
var USER = "admin";

//define AccessKey
var ACCESS_KEY = "MTZhOGQ5OTEtOTI0OS0zNzdmLWIyZTAtYTFkOTFhZTI2OTczIGFkbWluIFVTRVJfREVGQVVMVF9OQU1F";

//define SecretKey
var SECRET_KEY = "4b6v9i0kP7EjVzcuLMc4CUdkyq9AeTWheO2pr5CotGc";

//define Base Url
var BASE_URL = "https://e2f89b98.ngrok.io";


//define ContextPath
var CONTEXT_PATH = "/connect";

//define Expire Time
var EXPIRE_TIME = 3600;

//define api path
var RELATIVE_PATH = "/public/rest/api/1.0/cycles/search";

//define query string
var QUERY_STRING = "expand=action&projectId=10000&versionId=10000"

//Create canonical path for JWT. e.g: API Method & RELATIVE_PATH & QUERY_STRING (Asc Ordered)
var canonical_path = "GET&" + RELATIVE_PATH + "&" + QUERY_STRING;

//Details can be found here:
//Link: https://developer.atlassian.com/static/connect/docs/latest/concepts/understanding-jwt.html
var payload = new Dictionary<string, object>()
            {
                { "sub", USER },                    //assign subject 
                { "qsh", getQSH(canonical_path) },  //assign query string hash
                { "iss", ACCESS_KEY },              //assign issuer
                { "iat", iat },                     //assign issue at(in ms)
                { "exp", exp }                      //assign expiry time(in ms)
            };

string token = JWT.JsonWebToken.Encode(payload, SECRET_KEY, JWT.JwtHashAlgorithm.HS256);

Console.WriteLine(token);

About

ZAPI CSharp example JWT generate and make call to zapi

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

5 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.