├── BashCurl └── backorderapi.sh ├── CSharpExample ├── CSharpExample.sln ├── CSharpExample.v11.suo └── CSharpExample │ ├── App.config │ ├── CSharpExample.csproj │ ├── DropCatchApiExample.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── packages.config └── README.md /BashCurl/backorderapi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # bash/curl examples for interacting with the DropCatch's API 4 | 5 | #get a token 6 | token=`curl -d grant_type=client_credentials -d client_id=: --data-urlencode "client_secret=" https://api.namebright.com/auth/token | sed 's/{"access_token":"\([^"]*\).*/\1/'` 7 | 8 | 9 | #Standard Backorders 10 | curl -X POST -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d '{"domains": ["testdomain1.com","testdomain2.com"]', "routingCode": "standard"}' https://www.dropcatch.com/api/BackorderDomainsApi/BackOrderDomains 11 | 12 | #Discount Club Backorders 13 | curl -X POST -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d '{"domains": ["testdomain1.com,15","testdomain2.com,20"]', "routingCode": "discount"}' https://www.dropcatch.com/api/BackorderDomainsApi/BackOrderDomains 14 | 15 | 16 | #Cancel backorders (Standard or Discount) 17 | curl -X POST -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d '["testdomain1.com","testdomain2.com"]' https://www.dropcatch.com/api/BackorderDomainsApi/CancelBackOrders 18 | 19 | -------------------------------------------------------------------------------- /CSharpExample/CSharpExample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpExample", "CSharpExample\CSharpExample.csproj", "{AC1A2422-67FB-4725-966A-A239A81DC1FE}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {AC1A2422-67FB-4725-966A-A239A81DC1FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {AC1A2422-67FB-4725-966A-A239A81DC1FE}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {AC1A2422-67FB-4725-966A-A239A81DC1FE}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {AC1A2422-67FB-4725-966A-A239A81DC1FE}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /CSharpExample/CSharpExample.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NameBright/DropCatchBackorderExamples/32a39db100c92384e56a230fa09cabff6ebb2887/CSharpExample/CSharpExample.v11.suo -------------------------------------------------------------------------------- /CSharpExample/CSharpExample/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CSharpExample/CSharpExample/CSharpExample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {AC1A2422-67FB-4725-966A-A239A81DC1FE} 8 | Exe 9 | Properties 10 | CSharpExample 11 | CSharpExample 12 | v4.5 13 | 512 14 | .\ 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /CSharpExample/CSharpExample/DropCatchApiExample.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Net.Http; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CSharpExample 10 | { 11 | class DropCatchApiExample 12 | { 13 | static void Main(string[] args) 14 | { 15 | if (args.Length < 3) 16 | { 17 | PrintUsage(); 18 | return; 19 | } 20 | 21 | 22 | string accessToken = RetrieveAccessToken(); 23 | 24 | using (HttpClient httpClient = new HttpClient()) 25 | { 26 | httpClient.DefaultRequestHeaders.ExpectContinue = false; 27 | httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "*/*"); 28 | httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "httpclient/c#"); 29 | httpClient.DefaultRequestHeaders.Add("Authorization", String.Format("Bearer {0}", accessToken ?? String.Empty)); 30 | httpClient.BaseAddress = new Uri("https://www.dropcatch.com/"); 31 | 32 | var request = new BackorderRequest() 33 | { 34 | routingCode = args[1], 35 | domains = args.Skip(2).ToList() 36 | }; 37 | 38 | string data = JsonConvert.SerializeObject(request); 39 | var content = new StringContent(data, Encoding.UTF8, "application/json"); 40 | 41 | HttpResponseMessage result = null; 42 | if (args[0] == "backorder") 43 | { 44 | result = httpClient.PostAsync("/api/BackorderDomainsApi/BackOrderDomains", content).Result; 45 | } 46 | else if (args[0] == "cancel") 47 | { 48 | result = httpClient.PostAsync("/api/BackorderDomainsApi/CancelBackOrders", content).Result; 49 | } 50 | else 51 | { 52 | throw new Exception("Invalid command. Expecting 'backorder' or 'cancel'"); 53 | } 54 | string resultContent = result.Content.ReadAsStringAsync().Result; 55 | Console.WriteLine(resultContent); 56 | } 57 | } 58 | 59 | static string RetrieveAccessToken() 60 | { 61 | string accessToken = null; 62 | using (HttpClient httpClient = new HttpClient()) 63 | { 64 | httpClient.BaseAddress = new Uri("https://api.namebright.com/"); 65 | 66 | //TODO: fill in client_id and client_secret below. 67 | // Your application name will be in the form of "account name:application name". e.g. "MyAccount:MyApp" 68 | // Go here to manage api applications for your account: https://www.namebright.com/Settings#Api 69 | var content = new FormUrlEncodedContent(new[] { 70 | new KeyValuePair("grant_type", "client_credentials"), 71 | new KeyValuePair("client_id", /* FILL ME IN */ ""), 72 | new KeyValuePair("client_secret", /* FILL ME IN */ "") 73 | }); 74 | var result = httpClient.PostAsync("/auth/token", content).Result; 75 | string resultContent = result.Content.ReadAsStringAsync().Result; 76 | Console.WriteLine(resultContent); 77 | var anonType = new { access_token = string.Empty }; 78 | var tokenObject = JsonConvert.DeserializeAnonymousType(resultContent, anonType); 79 | accessToken = tokenObject.access_token; 80 | } 81 | return accessToken; 82 | } 83 | 84 | static void PrintUsage() 85 | { 86 | Console.WriteLine("CSharpExample.exe cancel|backorder standard|discount domain1[,maxbid] [domain2[,maxbid]] [domain3[,maxbid]] ... [domainn[,maxbid]]"); 87 | } 88 | } 89 | 90 | public class BackorderRequest 91 | { 92 | public string routingCode { get; set; } 93 | public List domains { get; set; } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /CSharpExample/CSharpExample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CSharpExample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CSharpExample")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("7e104991-45d1-48d1-bc96-5b21641d1f83")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CSharpExample/CSharpExample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DropCatchBackorderExamples 2 | ========================== 3 | 4 | We have exposed DropCatch.com API functions so that you can programmatically backorder domains. This feature makes use of NameBright.com API accounts, and is very similar to using the [REST](https://api.namebright.com/rest/Help "NameBright.com REST Domain API") endpoint for the [NameBright.com Domain API](https://github.com/NameBright/DomainApiClientExamples "NameBright.com Domain API"). 5 | 6 | Requirements 7 | ------------ 8 | 1. A NameBright.com account. Create one here: https://www.namebright.com/NewAccount 9 | 2. The NameBright.com account must be activated for API access. Start this process here: https://www.namebright.com/Settings#Api 10 | 3. Your API account in NameBright.com must have the "Register Domains" permission. 11 | 4. Your API account must have an IP whitelist defined. 12 | 5. You must have logged into DropCatch.com using your NameBright.com credentials at least once. 13 | 6. Before calling the API functions, you must retrieve a bearer token from the [NameBright.com Auth](https://api.namebright.com/auth/help) endpoint (see the examples). 14 | 15 | Example Code 16 | ------------ 17 | Use the following examples to get started with the DropCatch API: 18 | - CSharpExample: This is .NET 4.5 code which uses HttpClient to POST json to the DropCatch API. 19 | - BashCurl: a bash shell script which uses curl to POST json to the DropCatch API 20 | 21 | Download all example code from here: https://github.com/NameBright/DropCatchBackorderExamples/archive/master.zip 22 | 23 | Supported Functions 24 | ------------------- 25 | - Backorder one or more domain names 26 | - Cancel one or more domain backorders 27 | 28 | Example Responses 29 | ----------------- 30 | 31 | - Success 32 | ```json 33 | { 34 | "someErrors": false, 35 | "results": [ 36 | { 37 | "domainName": "TestDomain1.com", 38 | "success": true, 39 | "maxBid": "59.00", 40 | "message": "Backorder Accepted", 41 | "statusCode": "200.1" 42 | }, 43 | { 44 | "domainName": "TestDomain2.com", 45 | "success": true, 46 | "maxBid": "59.00", 47 | "message": "Backorder Accepted", 48 | "statusCode": "200.1" 49 | } 50 | ] 51 | } 52 | ``` 53 | 54 | - Partial Failure 55 | ```json 56 | { 57 | "someErrors": true, 58 | "results": [ 59 | { 60 | "domainName": "Foo.com", 61 | "success": false, 62 | "maxBid": "0.00", 63 | "message": "Foo.com is not in pending delete status.", 64 | "statusCode": "411.0" 65 | }, 66 | { 67 | "domainName": "TestDomain3.com", 68 | "success": true, 69 | "maxBid": "59.00", 70 | "message": "Backorder Accepted", 71 | "statusCode": "200.1" 72 | } 73 | ] 74 | } 75 | ``` 76 | 77 | 78 | --------------------------------------------------------------------------------