28msec/28.io-angularjs

View on GitHub
swagger/project.json

Summary

Maintainability
Test Coverage
{ "apiVersion" : "1.0", "swaggerVersion" : "1.2", "basePath" : "http://portal.28.io/api", "resourcePath" : "/project", "produces" : [ "application/json" ], "description" : "<div><p>These resources can be used to manage projects.\n         The endpoint of these resources is based on the portal URI and your project name. \n         For instance, if your 28.io project is named <code>myproject</code>, \n         your endpoint for this API will be will be: \n         <code>http://portal.28.io/api/myproject</code>.\n      </p><p>An access token needs to be provided to methods that require authentication.\n         An access token can be given in one of the following ways, ordered by priority:\n         <ol><li><code>X-28msec-Token</code> header;</li><li><code>_token</code> query parameter;</li><li><code>token</code> query parameter.</li></ol></p><h2>Custom Rewrite Rules</h2><p>\n         Custom rewrites rules allow to transform requests to your project, for instance, mapping GET requests to <pre>http://myproject.28.io/objects/{an-object-id}</pre>\n         as GET requests to <pre>http://myproject.28.io/v1/_queries/public/get-object.jq?object-id={an-object-id}</pre>.\n         This API works by exposing some of the features of the <a href=\"http://httpd.apache.org/docs/current/mod/mod_rewrite.html\">Apache mod_rewrite</a> module.         \n      </p><p>\n         A rewrite rule is composed by an array of conditions (corresponding to mod_rewrite <a href=\"http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond\">RewriteCond</a>\n         directives) and a rewrite directive (corresponding to a single mod_rewrite \n         <a href=\"http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule\">RewriteRule</a> directive).\n      </p><h3>Conditions</h3><div><p>\n\t\t\tAll the conditions that must be satisfied for the rewrite rule to be applied.\n\t\t\tEach condition allows to test a pattern on an Apache Server variable.\n\t\t\tThe conditions semantics can be optionally specifying one or more test flags.\n\t\t\tFor additional details refer to <a href=\"http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond\">RewriteCond</a>.\n        </p><p>\n           For instance the following two conditions are satisfied when the request method is GET and when the request URI\n           starts with <pre>/objects</pre>, as in <pre>GET http://myproject.28.io/objects/23</pre>.\n           <pre>\n[ \n  {\n    \"testVariable\": \"REQUEST_METHOD\",\n\t\"condPattern\": \"=GET\"\n  },\n  {\n    \"testVariable\": \"ENV:28_REQUEST_URI\",\n\t\"condPattern\": \"^/objects/\",\n\t\"flags\": [\"NC\"]\n  }\n]\n\t\t   </pre></p><p>\n           The test variable must be chosen from the following subset of the Apache\n\t\t\t<a href=\"http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond\">Server Variables</a>.\n        </p><p>\n           The list of allowed Apache variables is the following.\n           <ul><li>HTTP Headers:\n               <ul><li>HTTP_USER_AGENT</li><li>HTTP_REFERER</li><li>HTTP_COOKIE</li><li>HTTP_FORWARDED</li><li>HTTP_HOST</li><li>HTTP_PROXY_CONNECTION</li><li>HTTP_ACCEPT</li></ul></li><li>Server internals:\n               <ul><li>SERVER_ADMIN</li><li>SERVER_NAME</li><li>SERVER_ADDR</li><li>SERVER_PORT</li><li>SERVER_PROTOCOL</li><li>SERVER_SOFTWARE</li></ul></li><li>Connection and request:\n               <ul><li>REMOTE_ADDR</li><li>REMOTE_HOST</li><li>REMOTE_PORT</li><li>REMOTE_USER</li><li>REMOTE_IDENT</li><li>REQUEST_METHOD</li><li>REQUEST_URI</li><li>REQUEST_FILENAME</li><li>SCRIPT_FILENAME</li><li>PATH_INFO</li><li>QUERY_STRING</li><li>AUTH_TYPE</li></ul></li><li>Time:\n               <ul><li>TIME_YEAR</li><li>TIME_MON</li><li>TIME_DAY</li><li>TIME_HOUR</li><li>TIME_MIN</li><li>TIME_SEC</li><li>TIME_WDAY</li><li>TIME</li></ul></li><li>Specials:\n               <ul><li>API_VERSION</li><li>THE_REQUEST</li><li>IS_SUBREQ</li><li>HTTPS</li></ul></li></ul>\n           Two additional 28msec-specific environment variables are defined which ease writing conditions: \n           <ul><li>ENV:28_REQUEST_URI: this is the request uri relative to the project root. For instance it is\n                   set to <pre>/request</pre> for both these two requests: <pre>http://myproject.28.io/request</pre> and \n                   <pre>http://11.11.11.11/myproject/request</pre></li><li>ENV:28_PROJECT_BASE_URI: this is the base uri for the project, using the same addressing \n                   mechanism of the request. For instance, it is set to <pre>myproject.28.io</pre> for a request to \n                   <pre>http://myproject.28.io/request</pre>; and to <pre>11.11.11.11/myproject</pre> for a request to \n                   <pre>http://11.11.11.11/myproject/request</pre></li></ul></p><p>\n            The condition pattern supports the following restriction of the\n            <a href=\"http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond\">mod_rewrite</a> \n            condition pattern specification:\n            <ul><li>Regular expressions (e.g. <pre>^/objects/</pre>) are always allowed</li><li>Negation using the <pre>!</pre> character at the beginning of the pattern is always allowed</li><li>Lexicographical string comparison (e.g.: &lt;CondPattern) is always allowed</li><li>Integer comparison (e.g.: -eq 28) is always allowed</li><li>File attribute tests (e.g.: -f) are allowed only for the <pre>REQUEST_FILENAME</pre> variable</li><li>Variable references within the condition pattern is limited to the previous variable list</li></ul></p></div><h4>Rewrite</h4><div><p>\n\t\t\tThe rewrite specifies the transformation to be applied. It contains the pattern to be evaluated against the \n\t\t\tcurrent request and the substitution to perform if the pattern matches.  \n\t\t\tFor additional details refer to <a href=\"http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule\">RewriteRule</a>.\t\t\t\n        </p><p>\n           For instance the following rewrite transforms a request to <pre>http://myproject.28.io/objects/23</pre> to \n           a request to <pre>http://myproject.28.io/v1/_queries/public/get-object.jq?object-id=23</pre>.\n           <pre>      \n{\n\t  \"pattern\": \"^objects/([^/]+)$\",\n\t  \"substitution\": \"/v1/_queries/public/get-object.jq?object-id=$1\"\n}\n\t\t   </pre></p><p>\n           When writing rewrite objects take into account the following implementation details:\n           <ul><li>There is no <pre>/</pre> at the beginning of the string being matched</li><li>The rewrite rules will not override any request to the project APIs, but can interfere with legacy query and handler execution</li><li>Variable references within the pattern and substitution strings is limited to the previous variable list</li></ul></p></div><h4>Full example</h4><p>\n         The following example maps GET requests to <pre>http://myproject.28.io/objects/{an-object-id}</pre> as GET requests \n         to <pre>http://myproject.28.io/v1/_queries/public/get-object.jq?object-id={an-object-id}</pre>.\n      </p><p><pre>\n[\n  {\n    \"conditions\":\n\t[\n\t  {\n\t    \"testVariable\": \"REQUEST_METHOD\",\n\t\t\"condPattern\":  \"=GET\"\n\t  },\n\t  {\n\t    \"testVariable\": \"ENV:28_REQUEST_URI\",\n\t\t\"condPattern\":  \"^/objects/\",\n\t\t\"flags\": [\"NC\"]\n\t  }\n\t],\n\t\"rewrite\":\n\t{\n\t  \"pattern\": \"^objects/([^/]+)$\",\n\t  \"substitution\": \"/v1/_queries/public/get-object.jq?object-id=$1\"\n\t}\n  }\n]\n         </pre></p></div>", "apis" : [ { "path" : "/project", "operations" : [ { "method" : "GET", "summary" : "Retrieves the project metadata for all projects owned by an account", "notes" : "This method requires a valid API token. The metadata of the projects owned by the account corresponding to the given API token will be returned.", "type" : "array", "items" : { "$ref" : "Project" }, "nickname" : "listProjects", "parameters" : [ { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] }, { "method" : "POST", "summary" : "Creates a new project", "notes" : "<p>The project name must be between 3 and 40 characters long. It can contain only letter, numerical digits and dashes (-). A dash cannot appear as the first character.</p><p>If the specified package is payed, the account must have billing information and a new recurly subscription will be created.</p><p>This method requires a valid API token. If the project is created successfully, the owner of the project is the account associated with the specified API token.</p>", "type" : "NewProject", "nickname" : "createProject", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "query" }, { "name" : "template", "description" : "A template name. If not specified the 'default' template will be used.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "package", "description" : "A package name. If not specified the 'free' package will be used.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 402, "message" : "Recurly refused to complete the operation, due to errors in the billing information.", "responseModel" : "RecurlyError" }, { "code" : 409, "message" : "A project with the same name already exists.", "responseModel" : "Error" }, { "code" : 424, "message" : "The specified user has no billing data.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] } ] }, { "path" : "/project/{project-name}", "operations" : [ { "method" : "HEAD", "summary" : "Checks if a project exists", "notes" : "This method requires no authentication.", "type" : "void", "nickname" : "checkProject", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" } ], "responseMessages" : [ { "code" : 404, "message" : "The specified project cannot be found." } ] }, { "method" : "GET", "summary" : "Retrieves a project metadata", "notes" : "This method requires a valid API token generated for the account which owns the specified project.", "type" : "Project", "nickname" : "getProjectMetadata", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] }, { "method" : "PUT", "summary" : "Upgrades a project to the last Sausalito version", "notes" : "This method requires a valid API token generated for the account which owns the specified project.", "type" : "Success", "nickname" : "upgradeProject", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] }, { "method" : "PATCH", "summary" : "Changes a project metadata", "notes" : "<p>This method allows to rename or change the package of a project. Only one of the two modifications can be performed at the same time.</p><p>If renaming, the new project name must be between 3 and 40 characters long. It can contain only letter, numerical digits and dashes (-). A dash cannot appear as the first character. This method requires a valid API token generated for the account which owns the specified project.</p><p>If changing the project package, the following conditions must be satisfied: <ul><li>the used account must have billing information;</li><li>the current project package must be free</li><li>the specified package type must be payed</li></ul></p>", "type" : "Success", "nickname" : "updateProject", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "new-name", "description" : "The new project name.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "package", "description" : "The project package.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 402, "message" : "Recurly refused to complete the operation, due to errors in the billing information.", "responseModel" : "RecurlyError" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 424, "message" : "The specified user has no billing data.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] }, { "method" : "DELETE", "summary" : "Deletes a project", "notes" : "<p>If the project package is payed, the corresponding recurly subscription will be terminated.</p><p>This method requires a valid API token generated for the account which owns the specified project.</p>", "type" : "Success", "nickname" : "deleteProject", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] } ] }, { "path" : "/project/{project-name}/default-mongodb", "operations" : [ { "method" : "GET", "summary" : "Retrieves the default MongoDB credentials", "notes" : "For \"28msec\", \"local\" and \"none\" databases the response will only contain the \"db-type\" field. This method requires a valid API token generated for the account which owns the specified project.", "type" : "MongoDBCredentials", "nickname" : "getDefaultMongoDBCredentials", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] }, { "method" : "PUT", "summary" : "Updates a project default MongoDB credentials", "notes" : "The specified credentials can be of the following kinds: \"user\", \"mongolab\", \"28msec\", \"local\", \"none\". For all database kinds except \"user\" no credentials have to be specified. For \"user\" databases, at least the \"conn-string\" and the \"dbname\" parameter have to be specified. This method requires a valid API token generated for the account which owns the specified project.", "type" : "Success", "nickname" : "updateDefaultMongoDBCredentials", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" }, { "name" : "db-type", "description" : "The database type.", "required" : true, "type" : "string", "enum" : [ "user", "mongolab", "28msec", "local", "none" ], "paramType" : "query" }, { "name" : "conn-string", "description" : "The database connection string. Only for \"user\" databases.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "db", "description" : "The database name. Only for \"user\" databases.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "user", "description" : "The database user. Only for \"user\" databases.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "pass", "description" : "The database password. Only for \"user\" databases.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "pre-digested", "description" : "Whether the specified password is pre-digested or not. Only for \"user\" databases. Default is false.", "required" : false, "type" : "boolean", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 422, "message" : "The test of the specified credentials failed.", "responseModel" : "Tests" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] } ] }, { "path" : "/project/{project-name}/test-mongodb", "operations" : [ { "method" : "GET", "summary" : "Tests MongoDB credentials", "notes" : "This method requires a valid API token generated for the account which owns the specified project.", "type" : "MongoDBTests", "nickname" : "testDefaultMongoDB", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" }, { "name" : "conn-string", "description" : "The database connection string.", "required" : true, "type" : "string", "paramType" : "query" }, { "name" : "db", "description" : "The database name.", "required" : true, "type" : "string", "paramType" : "query" }, { "name" : "user", "description" : "The database user.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "pass", "description" : "The database password.", "required" : false, "type" : "string", "paramType" : "query" }, { "name" : "pre-digested", "description" : "Whether the specified password is pre-digested or not. Default is false.", "required" : false, "type" : "boolean", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] } ] }, { "path" : "/project/{project-name}/domains", "operations" : [ { "method" : "GET", "summary" : "Lists all custom domains of a project", "notes" : "This method requires a valid API token generated for the account which owns the specified project.", "type" : "array", "items" : { "type" : "string" }, "nickname" : "listCustomDomains", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] }, { "method" : "POST", "summary" : "Adds a custom domain to a project", "notes" : "The custom domain name must be at least 3 characters long. It consists of two or more groups of characters separated by a single dot (.). The last group consists of 2 to 6 lowercase letters. Any other group consists of one or more lowercase letters, numerical digits and dashes (-). A dash cannot appear as the first character of the group. Morever, the custom domain name cannot end with '.28.io'. This method requires a valid API token generated for the account which owns the specified project.", "type" : "Success", "nickname" : "addCustomDomain", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "domain-name", "description" : "The name of the new custom domain.", "required" : true, "type" : "string", "paramType" : "query" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 409, "message" : "A custom domain with the same name already exists.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] } ] }, { "path" : "/project/{project-name}/domains/{domain-name}", "operations" : [ { "method" : "DELETE", "summary" : "Deletes a project custom domain", "notes" : "This method requires a valid API token generated for the account which owns the specified project.", "type" : "Success", "nickname" : "deleteCustomDomain", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "domain-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project or custom domain does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ] } ] }, { "path" : "/project/{project-name}/rewrites", "operations" : [ { "method" : "GET", "summary" : "Lists the project custom rewrite rules", "notes" : "", "type" : "array", "items" : { "$ref" : "RewriteRule" }, "nickname" : "getCustomRewriteRules", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ], "successMessages" : [ { "code" : 200, "message" : "Lists the project custom rewrite rules.", "responseModel" : "array", "items" : { "$ref" : "RewriteRule" } } ], "examples" : [ { "title" : "Listing all custom rewrite rules", "description" : "The following request retrieves the list of all custom rewrite rules of the project named <code>myproject</code>.", "request" : "curl -X GET \"http://portal.28.io/api/project/rewrites?token=dGZKZ0VYT1VWV2l1R1BLQ1NBTjVmcEJlWU04PToyMDEzLTExLTA2VDAxOjU0OjI5LjgzOTQ1Wg==\"", "response" : "< 200 OK\n[\n  {\n    \"rewrite\":\n    {\n      \"pattern\": \"^test$\",\n      \"substitution\": \"/v1/_queries/public/test.jq\"\n    }\n  }\n]" } ] }, { "method" : "PUT", "summary" : "Sets the project custom rewrites rules", "notes" : "", "type" : "Success", "nickname" : "setCustomRewriteRules", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" }, { "name" : "custom-rewrites", "description" : "The new custom rewrites", "required" : true, "type" : "array", "items" : { "$ref" : "RewriteRule" }, "paramType" : "body" }, { "name" : "Content-Type", "type" : "string", "paramType" : "header", "enum" : [ "application/json; charset=utf-8" ] } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 422, "message" : "The test of the specified credentials failed.", "responseModel" : "Tests" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ], "successMessages" : [ { "code" : 200, "message" : "Sets the project custom rewrite rules list.", "responseModel" : "Success" } ], "examples" : [ { "title" : "Set the project custom rewrite rules", "description" : "The following request sets all custom rewrite rules of the project named <code>myproject</code>.", "request" : "curl -X PUT -H \"Content-Type: application/json\" -d '[\n  {\n    \"rewrite\":\n    {\n      \"pattern\": \"^test$\",\n      \"substitution\": \"/v1/_queries/public/test.jq\"\n    }\n  }\n]' \"http://portal.28.io/api/project/rewrites?token=dGZKZ0VYT1VWV2l1R1BLQ1NBTjVmcEJlWU04PToyMDEzLTExLTA2VDAxOjU0OjI5LjgzOTQ1Wg==\"", "response" : "< 200 OK\n{\n  \"success\" : true\n}" } ] }, { "method" : "DELETE", "summary" : "Removes the project custom rewrite rules", "notes" : "", "type" : "Success", "nickname" : "removeCustomRewriteRules", "parameters" : [ { "name" : "project-name", "description" : "The project name.", "required" : true, "type" : "string", "paramType" : "path" }, { "name" : "token", "description" : "An API token.", "required" : true, "type" : "string", "paramType" : "query" } ], "responseMessages" : [ { "code" : 400, "message" : "Bad request: a parameter is missing or invalid.", "responseModel" : "Error" }, { "code" : 401, "message" : "Unauthorized: the specified API token is invalid or expired.", "responseModel" : "Error" }, { "code" : 404, "message" : "The specified project does not exist.", "responseModel" : "Error" }, { "code" : 500, "message" : "An internal error occurred during the processing of the request.", "responseModel" : "Error" } ], "successMessages" : [ { "code" : 200, "message" : "Removes the project custom rewrite rules.", "responseModel" : "Success" } ], "examples" : [ { "title" : "Delete all custom rewrite rules", "description" : "The following request delets all custom rewrite rules of the project named <code>myproject</code>.", "request" : "curl -X DELETE \"http://portal.28.io/api/project/rewrites?token=dGZKZ0VYT1VWV2l1R1BLQ1NBTjVmcEJlWU04PToyMDEzLTExLTA2VDAxOjU0OjI5LjgzOTQ1Wg==\"", "response" : "< 200 OK\n{\n  \"success\" : true\n}" } ] } ] } ], "models" : { "Success" : { "id" : "Success", "description" : "Default success response", "required" : [ "success" ], "properties" : { "success" : { "type" : "boolean", "enum" : [ "true" ] } } }, "Error" : { "id" : "Error", "description" : "Error information", "required" : [ "code", "message", "description" ], "properties" : { "code" : { "type" : "string", "description" : "The XQuery error code of the error" }, "message" : { "type" : "string", "description" : "A formatted string which contain the error code (always) and the module name, line and column-number and error description (when available)" }, "description" : { "type" : "string", "description" : "The error description" }, "module" : { "type" : "string", "description" : "The error module" }, "line-number" : { "type" : "string", "description" : "The error line number" }, "column-number" : { "type" : "string", "description" : "The error column number" } } }, "Account" : { "id" : "Account", "description" : "Account metadata", "required" : [ "id", "email", "firstname", "lastname", "company", "createdAt", "type" ], "properties" : { "id" : { "type" : "string", "description" : "The account unique identifier" }, "type" : { "type" : "string", "description" : "The account type", "enum" : [ "temporary", "anonymous", "free", "full", "28msec", "admin" ] }, "email" : { "type" : "string", "description" : "The account email" }, "firstname" : { "type" : "string", "description" : "The account firstname" }, "lastname" : { "type" : "string", "description" : "The account lastname" }, "company" : { "type" : "string", "description" : "The account company" }, "createdAt" : { "type" : "date-time", "description" : "The date and time on which the account has been created" }, "confirmedAt" : { "type" : "date-time", "description" : "The date and time on which the account has been confirmed" }, "billingAccount" : { "type" : "string", "description" : "The account billing account" } } }, "AccountExtendedData" : { "id" : "AccountExtendedData", "description" : "Account extended data", "required" : [ "token_type", "expiration_date", "access_token", "refresh_token", "project_tokens", "accountMetadata", "projectsMetadata" ], "properties" : { "token_type" : { "type" : "string", "description" : "The API token type", "enum" : [ "bearer" ] }, "expiration_date" : { "type" : "date-time", "description" : "The expiration date of all the tokens in the response" }, "access_token" : { "type" : "string", "description" : "The API token" }, "refresh_token" : { "type" : "string", "description" : "The refresh token which can be used to refresh both the API and project tokens" }, "project_tokens" : { "type" : "ProjectTokens", "description" : "The project tokens which can be used to make request to the APIs on the project endpoints" }, "accountMetadata" : { "type" : "Account", "description" : "The account data." }, "projectsMetadata" : { "type" : "Projects", "description" : "The account projects data." } } }, "ProjectTokens" : { "id" : "ProjectTokens", "description" : "An object containing zero or more project tokens. Each project token is stored in a different field project_{name}, where {name} is the project name, (e.g.: portal).", "properties" : { "project_{name}" : { "type" : "string", "description" : "The token for the project {name}. One field for each project owned by the account will be present" } } }, "NewProject" : { "id" : "NewProject", "required" : [ "projectMetadata", "projectToken" ], "properties" : { "projectMetadata" : { "type" : "Project", "description" : "The project metadata of the newly created project" }, "projectToken" : { "type" : "string", "description" : "A project token for the newly created project. It is guaranteed to expire no sooner than the tokens already obtained for the account in the current session." } } }, "Project" : { "id" : "Project", "description" : "Project data", "required" : [ "name", "created", "packageName", "status" ], "properties" : { "name" : { "type" : "string", "description" : "The project name" }, "created" : { "type" : "date-time", "description" : "The date time on which the project was created" }, "packageName" : { "type" : "string", "description" : "The project package" }, "status" : { "type" : "string", "description" : "The project status" }, "version" : { "type" : "string", "description" : "The project version" }, "sausaVersion" : { "type" : "string", "description" : "The sausalito version used by the project" }, "updateableTo" : { "type" : "string", "description" : "The sausalito version to which the project can be updated, if any" }, "lastUpdated" : { "type" : "date-time", "description" : "The date on which the project was last updated" }, "browserUpdated" : { "type" : "date-time", "description" : "The date on which the project browser was last updated" }, "lastModified" : { "type" : "date-time", "description" : "The date on which the project was last modified" }, "compilerLiving" : { "type" : "date-time", "description" : "The last date and time in which the compiler has been started, provided it is still running" }, "namespace" : { "type" : "string", "description" : "The project namespace" }, "databaseType" : { "type" : "string", "description" : "The database type of the project default MongoDB database.", "enum" : [ "user", "mongolab", "28msec", "local", "none" ] } } }, "MongoDBCredentials" : { "id" : "MongoDBCredentials", "description" : "MongoDB credentials for the default MongoDB database", "required" : [ "db-type" ], "properties" : { "db-type" : { "type" : "string", "description" : "The database type", "enum" : [ "user", "mongolab", "28msec", "local", "none" ] }, "conn-string" : { "type" : "string", "description" : "The connection string" }, "db" : { "type" : "string", "description" : "The database name" }, "user" : { "type" : "string", "description" : "The username" }, "pass" : { "type" : "string", "description" : "The password" }, "pre-digested" : { "type" : "boolean", "description" : "Whether the credentials are pre-digested or not. Default is false." } } }, "Tests" : { "id" : "Tests", "description" : "Credentials tests result", "required" : [ "success", "tests" ], "properties" : { "success" : { "type" : "boolean", "description" : "Whether all tests passed or not" }, "tests" : { "type" : "array", "description" : "The array containing the results of each run test", "items" : { "$ref" : "MongoDBTest" } } } }, "Test" : { "id" : "Test", "description" : "Credentials test result", "required" : [ "name", "success", "message" ], "properties" : { "name" : { "type" : "string", "description" : "The name of the test", "enum" : [ "connection", "writeable" ] }, "success" : { "type" : "boolean", "description" : "Whether the test passed or not" }, "message" : { "type" : "string", "description" : "A description of the test result" } } }, "Rewrite" : { "id" : "Rewrite", "description" : "Rewrite rule", "required" : [ "pattern", "substitution" ], "properties" : { "pattern" : { "type" : "string", "description" : "Pattern regular expression" }, "substitution" : { "type" : "string", "description" : "Substitution URL" } } }, "Conditions" : { "id" : "Conditions", "description" : "Rewrite rule conditions", "required" : [ "testVariable", "condPattern" ], "properties" : { "testVariable" : { "type" : "string", "description" : "Tested variable name" }, "condPattern" : { "type" : "string", "description" : "Condition expression" } } } } }