{"id":19894,"date":"2015-05-24T11:51:11","date_gmt":"2015-05-24T06:21:11","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=19894"},"modified":"2016-12-19T14:54:56","modified_gmt":"2016-12-19T09:24:56","slug":"adobe-behance-portfolio-development-apis-node-behance-api","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/adobe-behance-portfolio-development-apis-node-behance-api\/","title":{"rendered":"Adobe Behance Portfolio development API&#8217;s: node-behance-api"},"content":{"rendered":"<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2015\/05\/68747470733a2f2f6c68332e676f6f676c6575736572636f6e74656e742e636f6d2f2d4c68766e4c4a333939634d2f56456545566f456a6f58492f41414141414141414179382f456b484a5a57744b6b664d2f773533302d683230372d6e6f2f626568616e63652d6c6f676f2d677265792e706e67-1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-19895\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/05\/68747470733a2f2f6c68332e676f6f676c6575736572636f6e74656e742e636f6d2f2d4c68766e4c4a333939634d2f56456545566f456a6f58492f41414141414141414179382f456b484a5a57744b6b664d2f773533302d683230372d6e6f2f626568616e63652d6c6f676f2d677265792e706e67-1.png\" alt=\"68747470733a2f2f6c68332e676f6f676c6575736572636f6e74656e742e636f6d2f2d4c68766e4c4a333939634d2f56456545566f456a6f58492f41414141414141414179382f456b484a5a57744b6b664d2f773533302d683230372d6e6f2f626568616e63652d6c6f676f2d677265792e706e67 (1)\" width=\"450\" height=\"176\" \/><\/a><\/p>\n<p><span style=\"color: #800000\">Behance<\/span> is an online portfolios website. Here a user can create and see\u00a0his\/her\/others portfolios. <span style=\"color: #800000\">node-behance-api<\/span> is an utility wrapper built on node.js for Adobe Behance rest services. This utility is <a href=\"http:\/\/www.tothenew.com\/mean-node-js-development-consulting\">developed for node.js only<\/a>. Currently it supports most of the API&#8217;s of Adobe Behance. You can upgrade or\u00a0add other new API&#8217;s via simply \u00a0coding. This\u00a0<span style=\"color: #800000\">node-behance-api<strong>\u00a0<\/strong><\/span>is more configurable than any third party module available on node.js.<\/p>\n<p>Before starting development on\u00a0<span style=\"color: #800000\">Behance<\/span>. You have to register a\u00a0app on Behance. \u00a0For registering your app you just need to follow simple steps. Register your app and get the client id from there.<\/p>\n<p>Working on \u00a0<span style=\"color: #800000\">node-behance-api<strong>\u00a0<\/strong><\/span>is very easy. You just need to require the\u00a0<span style=\"color: #800000\">node-behance-api<strong>. <\/strong><\/span>And here you go, you are ready to work on<span style=\"color: #800000\"><strong>\u00a0<\/strong>Behance<strong>\u00a0<\/strong><\/span><\/p>\n<h3>Requiring the <span style=\"color: #800000\">node-behance-api<\/span> to your nodejs app<\/h3>\n<p>[js]<\/p>\n<p>var Behance = require(&#8216;node-behance-api&#8217;);<\/p>\n<p>[\/js]<\/p>\n<p>Initializing\u00a0<span style=\"color: #800000\">node-behance-api<strong>\u00a0<\/strong><\/span>module is very easy. Once you have done with Behance constructor(create a object) , You can initialize\u00a0<span style=\"color: #800000\">\u00a0<\/span>Behance<span style=\"color: #800000\">\u00a0<\/span>by calling\u00a0<em>initOptions<\/em> method. Here below i have attached samples code snippet.<\/p>\n<p>[js]<\/p>\n<p>var Behance = require(&#8216;node-behance-api&#8217;);<\/p>\n<p>\/\/Initialize Behance module with your client_id<\/p>\n<p>var behance = new Behance({&#8216;client_id&#8217;: &#8216;xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#8217;})<br \/>\nBehance.initOptions();<\/p>\n<p>[\/js]<\/p>\n<p>Here <em>Behance.initOptions()<\/em> is where you initialize <span style=\"color: #800000\">node-behance-api<\/span>. You can further integrate\/update this module with other added API&#8217;s. We will see example later on.<br \/>\nCalling a simple API let&#8217;s say <em>users\/{user}<\/em><\/p>\n<h4>Example:<\/h4>\n<p>[js]<\/p>\n<p>var Behance = require(&quot;node-behance-api&quot;);<br \/>\nvar behance = new Behance({&quot;client_id&quot;: &quot;xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&quot;})<br \/>\nBehance.initOptions();<br \/>\nbehance.get({<br \/>\n    api: Behance.APIS.GET_USER,<br \/>\n    params: { \/\/or simply behance.get(&#8216;user&#8217;,<br \/>\n        user:&#8217;deepakmshrma&#8217;<\/p>\n<p>    }<br \/>\n}, function (error, result) {<br \/>\n    if (error)<br \/>\n        console.log(error)<br \/>\n    else<br \/>\n        console.log(result)<br \/>\n});<\/p>\n<p>[\/js]<\/p>\n<p>Here <em>Behance.APIS.GET_USER<\/em>, name of the API which you want to access. There are several API&#8217;s available. You can find API&#8217;s name in apiNameEnum.js or you can just simply\u00a0pass string as API&#8217;s\u00a0name here.<\/p>\n<h4>List of API&#8217;s available right now:<\/h4>\n<p>[js]<\/p>\n<p>var ENUM = {<br \/>\n    GET_USERS: &#8216;users&#8217;,<br \/>\n    GET_USER: &#8216;user&#8217;,<br \/>\n    GET_USER_PRODUCT: &#8216;user_products&#8217;,<br \/>\n    GET_USER_WIPS: &#8216;user_wips&#8217;,<br \/>\n    GET_USER_APR: &#8216;user_appreciations&#8217;,<br \/>\n    GET_USER_COLLECTIONS: &#8216;user_collections&#8217;,<br \/>\n    GET_USER_STATS: &#8216;user_stats&#8217;,<br \/>\n    GET_USER_FOLLOWERS: &#8216;user_followers&#8217;,<br \/>\n    GET_USER_FOLLOWEES: &#8216;user_following&#8217;,<br \/>\n    GET_USER_FEEDBACK: &#8216;user_feedback&#8217;,<br \/>\n    GET_USER_WORK_EXP: &#8216;user_work_experience&#8217;,<br \/>\n    GET_PRODUCTS: &#8216;projects&#8217;,<br \/>\n    GET_PRODUCT: &#8216;project&#8217;,<br \/>\n    GET_PRODUCT_COMMENTS: &#8216;project_comments&#8217;,<br \/>\n    GET_COLLECTIONS: &#8216;collections&#8217;,<br \/>\n    GET_COLLECTION: &#8216;collection&#8217;,<br \/>\n    GET_COLLECTION_PROJECTS: &#8216;collection_projects&#8217;,<br \/>\n    GET_WIPS: &#8216;wips&#8217;,<br \/>\n    GET_WIP_REVISION: &#8216;wip_revision&#8217;,<br \/>\n    GET_WIP_REVISION_COMMENTS: &#8216;wip_revision_comments&#8217;,<br \/>\n    GET_WIP: &#8216;wip&#8217;<br \/>\n}<\/p>\n<p>[\/js]<\/p>\n<h4>Integration of another API&#8217;s node-behance-api<\/h4>\n<p>Currently this <span style=\"color: #800000\">node-behance-api<\/span>\u00a0module supports most of the Behance API&#8217;s. But in future if you needed you can easily upgrade <span style=\"color: #800000\">node-behance-api<\/span>\u00a0with other list of API&#8217;s.\u00a0Refer to below given snippet.<\/p>\n<p>[js]<\/p>\n<p>var Behance = require(&#8216;node-behance-api&#8217;),<br \/>\n    extend = require(&#8216;extend&#8217;);<br \/>\nvar behance = new Behance({&#8216;client_id&#8217;: &#8216;xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#8217;})<br \/>\nBehance.initOptions({<br \/>\n    postProcess: function (options) {<br \/>\n        var newapis = {<br \/>\n            &#8216;newapis&#8217;: {<br \/>\n                &#8216;name&#8217;: &#8216;newapis&#8217;,<br \/>\n                &#8216;url&#8217;: &#8216;users&#8217;,<br \/>\n                &#8216;params&#8217;: {<br \/>\n                    &#8216;client_id&#8217;: true,<br \/>\n                    &#8216;q&#8217;: false,<br \/>\n                    &#8216;sort&#8217;: false<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n        options = extend(true, {}, newapis, options);<br \/>\n        return options;<br \/>\n    }<br \/>\n});<br \/>\nbehance<br \/>\n    .get({<br \/>\n        api: &#8216;newapis&#8217;,<br \/>\n        params: {<br \/>\n            user: &#8216;deepakmshrma&#8217;<br \/>\n        }<br \/>\n    }, function (error, result) {<br \/>\n        if (error)<br \/>\n            console.log(error)<br \/>\n        else<br \/>\n            console.log(result)<br \/>\n    });<\/p>\n<p>[\/js]<\/p>\n<p>Here i have used <a title=\"extend\" href=\"https:\/\/www.npmjs.com\/package\/extend\" target=\"_blank\">extend<\/a> \u00a0module to extend my previous option with new API details. You can use other third party tool for that.<\/p>\n<p>You can use this <em>initOptions<\/em> method to add new to the existing API&#8217;s or you can simply override current available API by passing same name as it is defined. It will simply override the previous API.<\/p>\n<h4>Example:<\/h4>\n<p>[js]<\/p>\n<p>Behance.initOptions({<br \/>\n    postProcess: function (options) {<br \/>\n        var newapis = {<br \/>\n            &#8216;users&#8217;: {<br \/>\n                &#8216;name&#8217;: &#8216;users&#8217;,<br \/>\n                &#8216;url&#8217;: &#8216;users&#8217;,<br \/>\n                &#8216;params&#8217;: {<br \/>\n                    &#8216;client_id&#8217;: true,<br \/>\n                    &#8216;q&#8217;: false,<br \/>\n                    &#8216;sort&#8217;: false,<br \/>\n                    &#8216;time&#8217;: false,<br \/>\n                    &#8216;field&#8217;: false,<br \/>\n                    &#8216;country&#8217;: false,<br \/>\n                    &#8216;state&#8217;: false,<br \/>\n                    &#8216;city&#8217;: false,<br \/>\n                    &#8216;page&#8217;: false,<br \/>\n                    &#8216;tags&#8217;: false,<br \/>\n                    &#8216;color_hex&#8217;: false,<br \/>\n                    &#8216;color_range&#8217;: false<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n        options = extend(true, {}, newapis, options);<br \/>\n        return options;<br \/>\n    }<br \/>\n});<\/p>\n<p>[\/js]<\/p>\n<h4>Error handling with node-behance-api<\/h4>\n<p>Error handling with this module is very easy. You can specify the mandatory param with options. If the param value is true. It means it is mandatory for given API&#8217;s.<\/p>\n<p>[js]<\/p>\n<p>&#8216;newapi&#8217; : {<br \/>\n    &#8216;name&#8217;: &#8216;newapis&#8217;,<br \/>\n    &#8216;url&#8217;: &#8216;users&#8217;,<br \/>\n    &#8216;params&#8217;: {<br \/>\n        &#8216;client_id&#8217;: true,<br \/>\n        &#8216;q&#8217;: false,<br \/>\n        &#8216;sort&#8217;: false,<br \/>\n        &#8216;time&#8217;: true,<br \/>\n        &#8216;field&#8217;: false,<br \/>\n        &#8216;country&#8217;: false,<br \/>\n        &#8216;state&#8217;: false,<br \/>\n        &#8216;city&#8217;: false,<br \/>\n        &#8216;page&#8217;: false,<br \/>\n        &#8216;tags&#8217;: false,<br \/>\n        &#8216;color_hex&#8217;: false,<br \/>\n        &#8216;color_range&#8217;: false<br \/>\n    }<br \/>\n}<br \/>\n\/\/Here param &#8216;time&#8217; is mandatory for newapi.<\/p>\n<p>[\/js]<\/p>\n<p>Hence i tried my best to explain all of the feature of the <span style=\"color: #800000\">node-behance-api<\/span>. You can further visit my <a title=\"Gitup\" href=\"https:\/\/github.com\/deepakshrma\/node-behance-api\" target=\"_blank\">Github<\/a> repository which is <a title=\"https:\/\/github.com\/deepakshrma\/node-behance-api\" href=\"https:\/\/github.com\/deepakshrma\/node-behance-api\" target=\"_blank\">https:\/\/github.com\/deepakshrma\/node-behance-api<\/a>.\u00a0In case of any issue regarding to <span style=\"color: #800000\">node-behance-api.\u00a0<\/span>Kindly raise your issue on <a title=\"https:\/\/github.com\/deepakshrma\/node-behance-api\/issues\" href=\"https:\/\/github.com\/deepakshrma\/node-behance-api\/issues\" target=\"_blank\">Github<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Behance is an online portfolios website. Here a user can create and see\u00a0his\/her\/others portfolios. node-behance-api is an utility wrapper built on node.js for Adobe Behance rest services. This utility is developed for node.js only. Currently it supports most of the API&#8217;s of Adobe Behance. You can upgrade or\u00a0add other new API&#8217;s via simply \u00a0coding. This\u00a0node-behance-api\u00a0is [&hellip;]<\/p>\n","protected":false},"author":136,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":3},"categories":[1185],"tags":[1522,1827,1447,1829,1828,1124,1177],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/19894"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/136"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=19894"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/19894\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=19894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=19894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=19894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}