{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/customers/:customer_id/licenses","auth":"required","params":[{"name":"customer_id","type":"int","default":"","desc":"Customer ID","required":false,"in":"path","ref":"","_id":"560a8c36f6994b0d0023bc3f"},{"name":"data[license_type_id]","type":"int","default":"","desc":"The ID of license type in DevMate (see below)","required":false,"in":"body","ref":"","_id":"56094af131beb60d001b65dd"}],"examples":{"codes":[{"name":"","code":"curl -H \"Authorization:Token b98f08d1c44cd5259dd70dc295e61187af45bffd23036f909919e608bdd8a592\" -i -X POST -d '{\"data\":{\"license_type_id\":26}}' \"https://public-api.devmate.com/v2/customers/45/licenses\"","language":"curl"}]},"method":"post","results":{"codes":[{"status":201,"language":"json","code":"{\n \"data\": {\n \"license_type_name\": \"MyNewApp Single User License\",\n \"license_type_id\": 26,\n \"invoice\": \"\",\n \"campaign\": \"\",\n \"activations_used\": 0,\n \"id\": 1185,\n \"expiration_date\": null,\n \"products\": [\n {\n \"id\": 1,\n \"name\": \"MyNewApp\",\n \"bundle_id\": \"com.acme.MyNewApp\",\n \"use_offline_license\": false\n }\n ],\n \"is_subscription\": false,\n \"status\": 1,\n \"activations_total\": 65535,\n \"activation_key\": \"id593311373237odr\",\n \"history\": [\n {\n \"type\": 2,\n \"user_name\": \"\",\n \"note\": \"\",\n \"timestamp\": 1446563864\n }\n ]\n }\n}","name":""},{"name":"Wrong customer ID","status":400,"language":"json","code":"{\n \"errors\": [\n {\n \"title\": \"Invalid field \\\"customer_id\\\".\",\n \"detail\": \"Mandatory parameter \\\"customer_id\\\" is empty.\"\n }\n ]\n}"},{"code":"{\n \"errors\": [\n {\n \"title\": \"Invalid field \\\"license_type_id\\\".\",\n \"detail\": \"Wrong \\\"license_type_id\\\" parameter given. License type #123 not found.\"\n }\n ]\n}","language":"json","status":400,"name":"Wrong license ID"}]},"settings":""},"next":{"description":"","pages":[]},"title":"Create License for Customer","type":"endpoint","slug":"create-license-for-customer","excerpt":"","body":"This method is used to create a license for the specific customer. The ID of customer needs to be passed in the URL of the request (`customer_id`). For example:\n\n````\nhttps://public-api.devmate.com/v2/customers/45/licenses\n````\nthis request will create a license for the customer with ID `45`.\n\nLicense ID can be found in DevMate Dashboard under *App Settings > License Types*.\n\nDescription of response fields see [here](doc:get-customers). \n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/cbRHrslhT8CjhBKb1kMn_License_type_id.png\",\n \"License_type_id.png\",\n \"1000\",\n \"579\",\n \"#fc1c15\",\n \"\"\n ]\n }\n ]\n}\n[/block]\nIn case of success, you will receive an activation number within the server response, so you may provide it to your customer.\n\nExample shows the creation of license with ID 26.\n\n#Response Codes\n[block:parameters]\n{\n \"data\": {\n \"0-0\": \"`201`\",\n \"0-1\": \"License was successfully created\",\n \"1-0\": \"`400`\",\n \"1-1\": \"Bad request. Customer id was not specified or incorrect or wrong license id provided\",\n \"2-0\": \"`401`\",\n \"2-1\": \"Authorization failed\",\n \"3-0\": \"`500`\",\n \"3-1\": \"Server error\"\n },\n \"cols\": 2,\n \"rows\": 4\n}\n[/block]","updates":[],"order":4,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"591f17b521d2ff0f00cf5a78","parentDoc":null,"project":"547cd7662eaee50800ed1089","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Public API","slug":"public-api","order":9,"from_sync":false,"reference":false,"_id":"591f17af21d2ff0f00cf5a48","__v":0,"project":"547cd7662eaee50800ed1089","createdAt":"2015-09-25T10:22:16.805Z","version":"591f17ae21d2ff0f00cf5a3f"},"user":"547cd6ac78fd57080023ca99","__v":0,"version":{"version":"1.0.1","version_clean":"1.0.1","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["591f17af21d2ff0f00cf5a40","591f17af21d2ff0f00cf5a41","591f17af21d2ff0f00cf5a42","591f17af21d2ff0f00cf5a43","591f17af21d2ff0f00cf5a44","591f17af21d2ff0f00cf5a45","591f17af21d2ff0f00cf5a46","591f17af21d2ff0f00cf5a47","591f17af21d2ff0f00cf5a48","60805d13afe7e7003acde2f9"],"_id":"591f17ae21d2ff0f00cf5a3f","createdAt":"2017-05-19T16:05:02.775Z","__v":2,"project":"547cd7662eaee50800ed1089","releaseDate":"2017-05-19T16:05:02.775Z"},"createdAt":"2015-09-28T14:13:05.096Z","githubsync":""}
postCreate License for Customer
Definition
{{ api_url }}{{ page_api_url }}
Parameters
Path Params
customer_id:
integer
Customer ID
Body Params
data[license_type_id]:
integer
The ID of license type in DevMate (see below)