From 69034c8e3f8ae37f79f2650be6d962885c6271ff Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Fri, 25 Dec 2015 22:42:59 -0600 Subject: [PATCH] Filling in some more API docs --- templates/docs.html | 140 +++++++++-------------------------------- templates/gophish.apib | 40 +++++------- 2 files changed, 44 insertions(+), 136 deletions(-) diff --git a/templates/docs.html b/templates/docs.html index 9ace11d6..ca0d8c49 100644 --- a/templates/docs.html +++ b/templates/docs.html @@ -1,4 +1,4 @@ -{{ define "base" }} +{{define "base"}} Gophish API Back to top

Delete a Campaign
DELETE/campaigns/{id}

Delete a campaign by its ID.

-
-

Caution

-

If the value for title or body is null or undefined, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will permanently overwrite the original value.

-
Parameters
HideShow
id
number (required) Example: 1

The Campaign ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "id": 1,
@@ -910,10 +906,6 @@ ers

"success": false, "data": null }

Delete a Template
DELETE/templates/{id}

Delete a template by its ID.

-
-

Caution

-

If the value for title or body is null or undefined, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will permanently overwrite the original value.

-
Parameters
HideShow
id
number (required) Example: 1

The Template ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "id": 1,
@@ -1123,10 +1115,6 @@ ers

"success": false, "data": null }

Delete a Group
DELETE/groups/{id}

Delete a Group by its ID.

-
-

Caution

-

If the value for title or body is null or undefined, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will permanently overwrite the original value.

-
Parameters
HideShow
id
number (required) Example: 1

The Template ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "id": 1,
@@ -1324,9 +1312,8 @@ ers

"message": "Page not found", "success": false, "data": null -}

Put Page
PUT/pages/{id}

Modify a page by its ID.

-
Parameters
HideShow
id
number (required) Example: 1

The Page ID

-
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
+}

Put Page
PUT/pages

Modify a page by its ID.

+
Request
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "id": 1,
   "name": "Example Page",
   "html": "<html><head></head><body>This is a test message!</body></html>",
@@ -1362,10 +1349,6 @@ ers

"success": false, "data": null }

Delete a Page
DELETE/pages/{id}

Delete a page by its ID.

-
-

Caution

-

If the value for title or body is null or undefined, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will permanently overwrite the original value.

-
Parameters
HideShow
id
number (required) Example: 1

The Page ID

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
   "id": 1,
@@ -1410,101 +1393,36 @@ ers

The fields expected in the CSV are as follows:

  • -

    Test

    +

    First Name

  • -

    two

    +

    Last Name

    +
  • +
  • +

    Position

    +
  • +
  • +

    Email

    +
  • +
  • +

    Company

-
Request
HideShow
Headers
Content-Type: application/json
Body
{
-  "id": 1,
-  "name": "Example Template",
-  "subject": "Example email template subject",
-  "text": "This is a test message!",
-  "html": "<html><head></head><body>This is a test message!</body></html>",
-  "attachments": [],
-  "modified_date": "2015-01-01T01:02:03.000000Z"
-}
Schema
{
-  "type": "object",
-  "properties": {
-    "id": {
-      "type": "number",
-      "description": "Unique identifier"
-    },
-    "name": {
-      "type": "string",
-      "description": "Name of template"
-    },
-    "subject": {
-      "type": "string",
-      "description": "Subject of email sent to users"
-    },
-    "text": {
-      "type": "string",
-      "description": "Raw text of email sent to users"
-    },
-    "html": {
-      "type": "string",
-      "description": "HTML of email sent to users"
-    },
-    "attachments": {
-      "type": "array",
-      "description": "The attachments sent with the email template"
-    },
-    "modified_date": {
-      "type": "string",
-      "description": "Date the Template was last modified"
-    }
-  },
-  "required": [
-    "id",
-    "name"
-  ],
-  "$schema": "http://json-schema.org/draft-04/schema#"
-}
Response  201
HideShow
Headers
Content-Type: application/json
Body
{
-  "id": 1,
-  "name": "Example Template",
-  "subject": "Example email template subject",
-  "text": "This is a test message!",
-  "html": "<html><head></head><body>This is a test message!</body></html>",
-  "attachments": [],
-  "modified_date": "2015-01-01T01:02:03.000000Z"
-}
Schema
{
-  "type": "object",
-  "properties": {
-    "id": {
-      "type": "number",
-      "description": "Unique identifier"
-    },
-    "name": {
-      "type": "string",
-      "description": "Name of template"
-    },
-    "subject": {
-      "type": "string",
-      "description": "Subject of email sent to users"
-    },
-    "text": {
-      "type": "string",
-      "description": "Raw text of email sent to users"
-    },
-    "html": {
-      "type": "string",
-      "description": "HTML of email sent to users"
-    },
-    "attachments": {
-      "type": "array",
-      "description": "The attachments sent with the email template"
-    },
-    "modified_date": {
-      "type": "string",
-      "description": "Date the Template was last modified"
-    }
-  },
-  "required": [
-    "id",
-    "name"
-  ],
+
Request
HideShow
Headers
Content-Type: multipart/form-data; boundary=----BOUNDARY
Body
------BOUNDARY
+Content-Disposition: form-data; name="files[]"; filename="filename.csv"
+Content-Type: application/vnd.ms-excel
+
+[File Content]
+------BOUNDARY
Response  201
HideShow
Headers
Content-Type: application/json
Body
[
+  {
+    "id": 1,
+    "first_name": "John",
+    "last_name": "Doe",
+    "email": "john.doe@example.com",
+    "position": "System Administrator"
+  }
+]
Schema
{
+  "type": "array",
   "$schema": "http://json-schema.org/draft-04/schema#"
 }
Response  400
HideShow
Headers
Content-Type: application/json
Body
{
   "message": "\"Error message\"",
diff --git a/templates/gophish.apib b/templates/gophish.apib
index e7deec6e..c01afbb2 100644
--- a/templates/gophish.apib
+++ b/templates/gophish.apib
@@ -184,11 +184,6 @@ Get a campaign by its ID.
 ### Delete a Campaign [DELETE] 
 Delete a campaign by its ID.
 
-::: warning
-####  Caution
-If the value for `title` or `body` is `null` or `undefined`, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will **permanently overwrite** the original value.
-:::
-
 + Parameters
 
     + id: `1` (required, number) - The Campaign ID
@@ -275,11 +270,6 @@ Get a template by its ID.
 ### Delete a Template [DELETE] 
 Delete a template by its ID.
 
-::: warning
-####  Caution
-If the value for `title` or `body` is `null` or `undefined`, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will **permanently overwrite** the original value.
-:::
-
 + Parameters
 
     + id: `1` (required, number) - The Template ID
@@ -363,11 +353,6 @@ Get a group by its ID.
 ### Delete a Group [DELETE] 
 Delete a Group by its ID.
 
-::: warning
-####  Caution
-If the value for `title` or `body` is `null` or `undefined`, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will **permanently overwrite** the original value.
-:::
-
 + Parameters
 
     + id: `1` (required, number) - The Template ID
@@ -465,11 +450,6 @@ Modify a page by its ID.
 ### Delete a Page [DELETE] 
 Delete a page by its ID.
 
-::: warning
-####  Caution
-If the value for `title` or `body` is `null` or `undefined`, then the corresponding value is not modified on the server. However, if you send an empty string instead then it will **permanently overwrite** the original value.
-:::
-
 + Parameters
 
     + id: `1` (required, number) - The Page ID
@@ -501,16 +481,26 @@ This endpoint allows you to import a group from a CSV.
 
 The fields expected in the CSV are as follows:
 
-+ Test
-+ two 
++ First Name
++ Last Name
++ Position
++ Email
++ Company
 
-+ Request (application/json)
++ Request (multipart/form-data; boundary=----BOUNDARY)
 
-    + Attributes (Template)
+    + Body
+
+            ------BOUNDARY
+            Content-Disposition: form-data; name="files[]"; filename="filename.csv"
+            Content-Type: application/vnd.ms-excel
+            
+            [File Content]
+            ------BOUNDARY
 
 + Response 201 (application/json)
 
-    + Attributes (Template)
+    + Attributes (TargetList)
 
 + Response 400 (application/json)