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 - MaxCDN/java-maxcdn: BETA - Java SDK for MaxCDN's API

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests/tests
tests/tests
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

MaxCDN REST API Java Client (BETA)

Requirements

  • Java 1.6 or Later

Usage

import com.maxcdn.MaxCDN;
import com.maxcdn.MaxCDNObject;
import com.maxcdn.MaxCDNRequest;
....
//Class construction
MaxCDN api = new MaxCDN(YOUR_ALIAS ,YOUR_CONSUMER_KEY,YOUR_CONSUMER_SECRET);
//Performing a GET request
MaxCDNObject data = api.get("/account.json");

Advanced Usage

This section describes how to perform PUT and POST requests.

//Creating a Push Zone
try {
	MaxCDNRequest post_parameters = new MaxCDNRequest("name", "NewZone").append("password", "password");
	api.post("/zones/push.json", post_parameters);
} catch (JSONException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}

Error Handling

//Attempting to create a Push Zone with the same name
try {
	MaxCDNRequest post_parameters = new MaxCDNRequest("name", "NewZone").append("password", "password");
	MaxCDNObject data = api.post("/zones/push.json", post_parameters);
	if(data.error) System.out.println(data.getErrorMessage());
	else {
	  System.out.println("Operation successful");
	}
} catch (JSONException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}

Supported OAuth request methods

GET

api.get("/account.json");

DELETE

String id = "33706";
api.delete("/users.json/"+id);

PUT

try {

MaxCDNRequest params = new MaxCDNRequest("street1", "1234 Main Street")
.append("street2", "apt 42")
.append("state", "CA");

api.put("/account.json/address",params);

} catch (JSONException){
 e.printStrackTrace();
}

POST

try {

	MaxCDNRequest post_parameters = new MaxCDNRequest("name", "NewZone")
	.append("password", "password");

	api.post("/zones/push.json", post_parameters);

} catch (JSONException e) {
	e.printStackTrace();
}

About

BETA - Java SDK for MaxCDN's API

Resources

Readme
MIT license
Activity
Custom properties

Stars

1 star

Watchers

6 watching

Forks

4 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — 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.