{"__v":6,"_id":"56094876c5cff70d007d016a","category":{"__v":7,"_id":"56052058e266000d008971c7","pages":["5605215df6b86e0d00284ab5","56052995d5c3900d0003e83d","56056243e266000d0089720e","56056496f6b86e0d00284b09","56094876c5cff70d007d016a","5609493a31beb60d001b65d9","56094af131beb60d001b65db"],"project":"547cd7662eaee50800ed1089","version":"547cd7662eaee50800ed108c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-25T10:22:16.805Z","from_sync":false,"order":8,"slug":"public-api","title":"Public API"},"editedParams":true,"editedParams2":true,"parentDoc":null,"project":"547cd7662eaee50800ed1089","user":"547cd6ac78fd57080023ca99","version":{"__v":9,"_id":"547cd7662eaee50800ed108c","project":"547cd7662eaee50800ed1089","createdAt":"2014-12-01T21:02:30.851Z","releaseDate":"2014-12-01T21:02:30.851Z","categories":["547cd7672eaee50800ed108d","54c8f8ae0174630d00efa874","54c8f8bd7a11f60d0022a832","54c8f8c60174630d00efa876","54c8f8f10174630d00efa877","55155826bc466623002afe83","551558324c7c1e39003735a0","56052058e266000d008971c7","57909a453b845d0e006a37d5"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":["563bbf3fe951f60d000b45a2"],"next":{"pages":[],"description":""},"createdAt":"2015-09-28T14:02:30.969Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"curl","code":"curl -H \"Authorization:Token b98f08d1c44cd5259dd70dc295e61187af45bffd23036f909919e608bdd8a592\" -X POST -d '{\"data\": {\"email\":\"jdoe:::at:::acme.corp\",\"first_name\":\"John\",\"last_name\":\"Doe\",\"note\":\"Our valuable customer\"}}' \"https://public-api.devmate.com/v2/customers/\"","name":""}]},"method":"post","results":{"codes":[{"status":201,"language":"json","code":"{\n \"data\": { \n    \"id\": 45,\n    \"email\": \"jdoe@acme.corp\",\n    \"first_name\": \"John\",\n    \"last_name\": \"Doe\",\n    \"company\": \"MacPaw\",\n    \"phone\": \"5553423322\",\n    \"address\": \"Madison Ave. 11\",\n    \"note\": \"Our valuable customer\",\n    \"date_added\": 1443185520\n }\n}","name":""},{"status":400,"language":"json","code":"{\n    \"errors\": [\n        {\n            \"title\": \"Invalid field \\\"email\\\".\",\n            \"detail\": \"Mandatory parameter \\\"email\\\" is empty or incorrect.\"\n        }\n    ]\n}","name":""},{"code":"{\n    \"errors\": [\n        {\n            \"title\": \"Unauthorized\"\n        }\n    ]\n}","language":"json","status":401},{"status":409,"language":"json","code":"{\n    \"errors\": [\n        {\n            \"title\": \"Invalid field \\\"email\\\".\",\n            \"detail\": \"This email already exists.\"\n        }\n    ]\n}"}]},"settings":"","auth":"required","params":[{"_id":"56094a40a7b2590d0089eb89","ref":"","in":"body","required":true,"desc":"Customer's email (**mandatory**)","default":"","type":"string","name":"data[email]"},{"_id":"56094a40a7b2590d0089eb8b","ref":"","in":"body","required":false,"desc":"Customer's last name","default":"","type":"string","name":"data[last_name]"},{"_id":"56094a40a7b2590d0089eb8a","ref":"","in":"body","required":false,"desc":"Customer's first name","default":"","type":"string","name":"data[first_name]"},{"_id":"57c04ae964ebf60e006886ed","ref":"","in":"body","required":false,"desc":"Customer's company name","default":"","type":"string","name":"data[company]"},{"_id":"57c04ae964ebf60e006886ec","ref":"","in":"body","required":false,"desc":"Customer's phone number","default":"","type":"string","name":"data[phone]"},{"_id":"57c04ae964ebf60e006886eb","ref":"","in":"body","required":false,"desc":"Customer's address","default":"","type":"string","name":"data[address]"},{"_id":"563a204dd25e8919005f3ec8","ref":"","in":"body","required":false,"desc":"Additional notes","default":"","type":"string","name":"data[note]"}],"url":"/customers"},"isReference":false,"order":2,"body":"This method is used to add information about customer.\n\n`email` is a mandatory field and should be unique.\n\nExample request demonstrates adding a customer John Doe with an email jdoe@acme.corp.\n\n#Response Codes\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"`201`\",\n    \"0-1\": \"Customer was created successfully\",\n    \"1-0\": \"`400`\",\n    \"1-1\": \"Request parameter is absent or incorrect. For example, wrong email address.\",\n    \"3-0\": \"`409`\",\n    \"3-1\": \"Customer with such email is already registered\",\n    \"4-0\": \"`500`\",\n    \"4-1\": \"Server error\",\n    \"2-0\": \"`401`\",\n    \"2-1\": \"Authorization failed\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]","excerpt":"","slug":"create-customer","type":"endpoint","title":"Create Customer"}

postCreate Customer


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

data[email]:
required
string
Customer's email (**mandatory**)
data[last_name]:
string
Customer's last name
data[first_name]:
string
Customer's first name
data[company]:
string
Customer's company name
data[phone]:
string
Customer's phone number
data[address]:
string
Customer's address
data[note]:
string
Additional notes

Examples


Result Format


Documentation

This method is used to add information about customer. `email` is a mandatory field and should be unique. Example request demonstrates adding a customer John Doe with an email jdoe@acme.corp. #Response Codes [block:parameters] { "data": { "0-0": "`201`", "0-1": "Customer was created successfully", "1-0": "`400`", "1-1": "Request parameter is absent or incorrect. For example, wrong email address.", "3-0": "`409`", "3-1": "Customer with such email is already registered", "4-0": "`500`", "4-1": "Server error", "2-0": "`401`", "2-1": "Authorization failed" }, "cols": 2, "rows": 5 } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}