Skip to content

This repository provides helper methods for interacting with Porkbun's V3 API, simplifying tasks like sending requests and handling responses for domain management and DNS automation.

License

Notifications You must be signed in to change notification settings

Shockelite/PorkbunAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Porkbun API Shortcuts

This repository provides helper methods for easily interacting with the V3 Porkbun API. It simplifies tasks like sending requests and handling responses, so you can quickly integrate with Porkbun's services for domain management and DNS. Automate your domain.

Features:

  • Shortcuts for sending requests to the Porkbun API.
  • Automatic serialization and deserialization of data.
  • Compatible versions with .NET Framework and .NET Core.

Notice:

  • The .NET Framework builds require Newtonsoft.Json.

Prerequisites:

You must have an API key and secret issued from Porkbun's API page.

Usage

Example of using the Porkbun.API class

First, create an instance of the Porkbun.API class by passing your API key and secret to the constructor.

using System;
using Porkbun;

class Program {
    static async Task Main(string[] args) {
        // Instantiate the Porkbun API client
        API api = new API("api-key", "api-secret");

        // Example 1: Ping the Porkbun API
        var ping = await api.Ping(); 

        // Example 2: Add DNS record
        var dns = await api.DnsAdd("domain.com", DnsRecordType.A, "mysubdomain", "1.1.1.1");

        // Example 3: Get wildcard SSL auto-generated by Porkbun with ratelimit protection.
        var ssl = await API.RateLimitRetry(() => api.SslGet("domain.com"));
        ssl.SaveToFiles("Certificate/", "cert.crt", "private.key", "public.key");
    }
}

About

This repository provides helper methods for interacting with Porkbun's V3 API, simplifying tasks like sending requests and handling responses for domain management and DNS automation.

Topics

Resources

License

Stars

Watchers

Forks

Languages