Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Smith committed Dec 3, 2020
1 parent 14e975d commit 9c41a12
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The easiest way to install and use this client library is using Composer. The fo
composer require tiggee/dnsmadeeasy-client
```

## Usage
## Getting Started

You will need a DNS Made Easy account and API credentials. You can get an account at the [DNS Made Easy website](https://www.dnsmadeeasy.com). There is an API sandbox available, you can create a [new account here](https://sandbox.dnsmadeeasy.com/account/new).

Expand Down Expand Up @@ -45,6 +45,44 @@ You can tell the client to use the sandbox API endpoint by using the `setEndpoin
$client->setEndpoint('https://api.sandbox.dnsmadeeasy.com/V2.0');
```

### Putting it all together

Putting this together, it's time for the API equivalent of Hello World. Let's get a list of your domains.

```php
<?php
// Load the library and dependencies
require_once 'vendor/_autoload.php';

// Create a new client and set our credentials
$client = new \DnsMadeEasy\Client;
$client->setApiKey("Your API Key");
$client->setSecretKey("Your Secret Key");

// Configure it to use the Sandbox
$client->setEndpoint('https://api.sandbox.dnsmadeeasy.com/V2.0');

// Create a new domain
$domain = $client->domains->create();
$domain->name = 'mydomain.example.com';
$domain->save();

// Print out our domain
echo json_encode($domain, JSON_PRETTY_PRINT);

// Now fetch a list of our domains
$domains = $client->domains->paginate();
foreach ($domains as $domain) {
echo json_encode($domain, JSON_PRETTY_PRINT);
}
```

There's more examples further down of using the API client SDK.

## Configuration

There's additional configuration options you can use with the client as well as just specifying the sandbox.

### Logging

You can specify a logger that implements the [PSR-3 Logger](https://www.php-fig.org/psr/psr-3/) specification such as MonoLog. The client is a `LoggerAwareInterface` and the logger can be specified either in the constructor or via a method call.
Expand Down Expand Up @@ -131,7 +169,7 @@ $domain = $client->domains->get(1234);
$domain->delete();
```

### Full Example
### Creating a domain and records

This example creates a new domain and adds records to it.

Expand Down

0 comments on commit 9c41a12

Please sign in to comment.