Notice (8): compact(): Undefined variable: etagMatches [CORE/src/Http/Response.php, line 1864]
Notice (8): compact() [<a href='https://secure.php.net/function.compact'>function.compact</a>]: Undefined variable: timeMatches [CORE/src/Http/Response.php, line 1864]
Warning (2): count() [<a href='https://secure.php.net/function.count'>function.count</a>]: Parameter must be an array or an object that implements Countable [CORE/src/Database/QueryCompiler.php, line 128]
Warning (2): count() [<a href='https://secure.php.net/function.count'>function.count</a>]: Parameter must be an array or an object that implements Countable [CORE/src/Database/QueryCompiler.php, line 128]
Warning (512): Unable to emit headers. Headers sent in file=/var/www/api/vendor/cakephp/cakephp/src/Error/Debugger.php line=822 [CORE/src/Http/ResponseEmitter.php, line 48]
Warning (2): Cannot modify header information - headers already sent by (output started at /var/www/api/vendor/cakephp/cakephp/src/Error/Debugger.php:822) [CORE/src/Http/ResponseEmitter.php, line 148]
Warning (2): Cannot modify header information - headers already sent by (output started at /var/www/api/vendor/cakephp/cakephp/src/Error/Debugger.php:822) [CORE/src/Http/ResponseEmitter.php, line 177]

Browzzer Api Documentation

In order to get the api base url, you should always use https://api.browzzer.com/get-config
The response would be json data like the following:

{
"service-base-url": "https://www.browzzer.com:82/api/v3.5",
"service-base-url2": "https://api.browzzer.com:82/api/v3.5",
"service-timeout": 20000,
"developer-service-server1-url": "https://api.browzzer.com:82/api/v3.1",
"app-link-android": "https://play.google.com/store/apps/details?id=com.Browzzer"
}

You should use the value in "developer-service-server1-url".
So for the example above, the api base url would be https://api.browzzer.com:82/api/v3.1

* As of version 3.1 onward, you need to provide the server with a token. 

Token comes after the api base url and for services when user is not logged in which are considered public, you should use "public" for token. In order to get a token, user should login first. In the response, you should have "token_ws" in the response.
All services that are related to users and have user_id in them whould use "token_ws" which is received after login.

Basic operations:

1. Adding user (public service)

In order to add user, you need to call api_base_url/public/user/signup with POST method and send the following data.
name, username, password, email, f_name, l_name, gender, birth, occupation, phone, image_id, public, city, country, google_key, facebook_key
The items are optional but it is advised to set username, password and email so that you can work with that user.
If you set the 'public' field to 1, other users will be able to follow this user without any permission but if this field is set to 0, when other users follow this user, he will be notified and has to accept or deny the follow request.
If you are creating the user after authorizing with Facebook or Google, you should set the unique identifier you get in the facebook_key or google_key fields.
In case of success, the system will send you {'ok': 1, 'id': <user_id>} and in case of failure, you will receive {'ok': 0}

So in short form:
POST /user/signup
parameters: name, username, password, email, f_name, l_name, gender, birth, occupation, phone, image_id, public, token, city, country, google_key, facebook_key
return:
true: {'ok': 1, 'id': <user_id>}
false:{'ok': 0}

2. Updating user
In order to update a user, you need to use PUT method. Please be advised that you cannot update username or password using this method.
PUT /user/<int:user_id>
parameters: name, f_name, l_name, gender, birth, occupation, phone, image_id, public, city, country, facebook_key, google_key
return:
true: {'ok': 1}
false:{'ok': 0}

3. Uploading file to the server (public service)
In order to set the profile image for a user, you need to upload the image to the server. To do so, you need to do the following:
POST /file/upload/
parameters: file
return {'ok': 1, 'file_id': <file_id>}
Please be advised that you should use the binary data here.

4. Logging in (public service)
In order to login, you should provide the server with username and password as described below:
POST /user/login
parameters: username, password
return:
true: {'ok': 1, 'user': {<user info json>} }
false:{'ok': 0, 'user': None}

5. Checking if a user exists (public service)
POST /user/exist
parameters: username
return:
true: {'ok': 1, 'id': <user_id>}
false:{'ok': 0}

6. Logging in using Facebook or Google (public service)
In order to login using Facebook or Google, you first need to register the unique identifier you get from Facebook or Google and use it to update an existing user or if the user doesn't exist, use it when you create the user.
So this is the procdure you should do when you get response from Facebook or Google.
a. check if the user exists on our server. The username is always the email address you get from Facebook or Google.
b. if the user doesn't exist, use the method explained in adding user.
c. if the user exists, update user using the method explained in updating user and set facebook_key or google_key.
d. log the user in using the method explained below:

Google:
POST /user/login/google/<string:identifier>
Facebook:
POST /user/login/facebook/<string:identifier>
return:
true: {'ok': 1, 'user': {<user info json>} }
false:{'ok': 0, 'user': None}

7. Activating user (public service)
Since user activation is done after user clicks on the link he receives in his email, there is nothing to do here. But for testing purposes, you can use the following method to activate a user.
POST /user/<int:user_id>/active
return:
true: {'ok': 1}
false:{'ok': 0}

8. Following users
In order to follow a user, you should send two user ids to the server using the format below:
POST /user/<int:current_user_id>/follow/request/<int:other_user_id>
results: {'ok': 1}

9. Accepting follow request
In order to accept the follow request, you should use the format below:
PUT '/user/<int:current_user_id>/follow/request/<int:requester_user_id>/accept
results: {'ok': 1}

10. Denying follow request
In order to accept the follow request, you should use the format below:
PUT '/user/<int:current_user_id>/follow/request/<int:requester_user_id>/deny
results: {'ok': 1}

Examples:
The logged in user has a user_id of 1 and wants to follow another user with user_id of 2.
POST /user/1/follow/request/2

Now user with user_id of 2 logs in and wants to accept the follow request from user with user_id of 1.
PUT '/user/2/follow/request/1/accept
or he wants to deny it.
PUT '/user/2/follow/request/1/deny

11. Adding items
Items in browzzer consist of two types, albums and pages. Pages are subsets of Albums. Each album can have one or more pages and each page always has one album. Pages do not belong to different albums.
In the api, albums are referred to as bins and pages as boxes. So a bin can have one or more boxes and a box always has a bin. Boxes do not belong to different bins.

Creating albums:
In order to create an album, here is what you should do:

POST /user/<int:user_id>/item/
parameters: type, title, security, def_image, category
Here is what you should set for each field:
type: bin
security: private or public
def_image: the image_id for the default image of the page which will be displayed in the list of pages in bfeed, favorite, shared, etc. In order to get the image_id, you need to read the section about uploading a file to the server.
image: a comma separated list of image_ids. In order to get the image_id, you need to read the section about uploading a file to the server.
save_ok: 0 or 1. 0 means that others cannot duplicate this page for themselves and 1 means that they can do so.

return {'ok': 1, 'id': <item_id>}


Creating pages:
In order to create a page, here is what you should do:

POST /user/<int:user_id>/item/
parameters: type, title, bin_id, image, def_image, text, location, geo, rank, price, saveok, category, cf_field1, cf_field2, ...
Here is what you should set for each field:
type: box
bin_id: the id of album you want to add data to
def_image: the image_id for the default image of the page which will be displayed in the list of pages in bfeed, favorite, shared, etc. In order to get the image_id, you need to read the section about uploading a file to the server.
image: a comma separated list of image_ids. In order to get the image_id, you need to read the section about uploading a file to the server.
save_ok: 0 or 1. 0 means that others cannot duplicate this page for themselves and 1 means that they can do so.

Field names that start with cf_ are custom fields and an alnum can have unlimited number of custom fields. In order to create custom fields, you should add cf_ to the beginning of field names. Imagine you want to add a country field for an album. The existing fields of a page does not include a "country" field so we have to use custom fields. If we POST cf_country with other data and use the value of the country for that record, we will be able to save country info for our page. The custom fields will be available for all pages in an album so when you add a custom field for a page, you should add it to the parent album as well and when a new page is created, it should show the existing custom fields as well.

return {'ok': 1, 'id': <item_id>}

Example:

Adding a new album

POST /user/<int:user_id>/item/
data: type=bin&title=My Album&security=public&def_image=1611161dd3c436e8244a40a646c250053743d0.jpg&category=Furniture
return {'ok': 1, 'id': 1}

Adding a new page to album with id of 1:
data: type=box&title=My Page&bin_id=1&image=1611161dd3c436e8244a40a646c250053743d2.jpg,1611161dd3c436e8244a40a646c250053743d3.jpg&def_image=1611161dd3c436e8244a40a646c250053743d2.jpg&text=I really like it&location=2384-2388,Yonge Street,Ontario,Canada&geo=43.7090808,-79.3988619&rank=5.0&price=2.00&saveok=1
return {'ok': 1, 'id': 2}

Updating pages

In order to update a page you need to call /user/<int:user_id>/item/<page_id> with PUT method. You can set one or more parameters from the page parameters.

Creating deals:
Creating a deal is like creating a page. Only the parameters are different. Here are the parameters:

parameters: type, is_deal, title, security, image, def_image, text, location, geo, rank, price, sale, sale_percent, saveok, category, provider, expire_date, permit_comment
Here is what you should set for each field:
type: box
is_deal: 1
def_image: the image_id for the default image of the deal which will be displayed in the list of deals in bfeed, favorite, shared, etc. In order to get the image_id, you need to read the section about uploading a file to the server.
image: a comma separated list of image_ids. In order to get the image_id, you need to read the section about uploading a file to the server.
save_ok: 0 or 1. 0 means that others cannot duplicate this page for themselves and 1 means that they can do so.

return {'ok': 1, 'id': <item_id>}

Updating deals

In order to update a deal you need to call /user/<int:user_id>/item/<deal_id> with PUT method. You can set one or more parameters from the deal parameters.

12. Getting list of user's albums and pages

In order to get the list of current user's albums, here is what you should do:

GET /user/<int:user_id>/line/me/home_bin/<int:start>/<int:count>

This is what you get in response

{"count": 2,"get-more": 2,"items": [{"bought": "0","category": " ","comments": "4","date": "1480262086.251295","def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "310","image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","is_liked": false,"likes": "0","modify": "1481994608.398945","price": "12.00","rank": "1.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "GyZAaS","type": "bin","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"},{"bought": "0","category": " ","comments": "0","date": "1480262082.435364","def_image": "1611273385f589827d444d8f644074f8d2de87.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "309","image": "1611273385f589827d444d8f644074f8d2de87.jpg","is_liked": false,"likes": "0","modify": "1481994607.632475","price": "17.00","rank": "2.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "OVQZmj","type": "bin","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"}],"ok": 1,"request_id": "2722180f-b7ab-4a47-b6d4-c54c67da10eb"}

To get the list of pages inside an album, you need to present the album_id to the api. Here is how it is done.

GET /user/<int:user_id>/item/<int:item_id>/subitems/

This is what you get in response

{"count": 7,"items": [{"bin": {"def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","id": "310","title": "GyZAaS"},"bin_id": "310","bought": "0","comments": "1","date": "1480263997.19137","def_image": "1611279685278a478a4c5ead7477e6fc7b6baf.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "335","image": "1611279685278a478a4c5ead7477e6fc7b6baf.jpg,1611274265343160d7436d9f42855f2d53c8a4.jpg","is_liked": true,"likes": "1","location": " ","modify": "1481994609.529352","price": "12.00","rank": "5.0","saveok": "1","saves": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "zgkXXz","type": "box","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"},{"bin": {"def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","id": "310","title": "GyZAaS"},"bin_id": "310","bought": "0","comments": "0","date": "1480263996.2025","def_image": "1611275877472569524d10b9d87d12ca5f0763.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "334","image": "1611275877472569524d10b9d87d12ca5f0763.jpg,161127266bdf459b1240c2a25a4e0c9daa4366.jpg","is_liked": true,"likes": "1","location": " ","modify": "1481994611.567195","price": "5.00","rank": "3.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "iARVNk","type": "box","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"},{"bin": {"def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","id": "310","title": "GyZAaS"},"bin_id": "310","bought": "0","comments": "0","date": "1480263992.058451","def_image": "161127f587d6783a1b4708a1aba99512c46f2d.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "330","image": "161127f587d6783a1b4708a1aba99512c46f2d.jpg,16112726661aeb50df4cddbf6c0b1df21db024.jpg","is_liked": true,"likes": "1","location": " ","modify": "1481994612.746357","price": "11.00","rank": "1.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "FKMIEm","type": "box","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"},{"bin": {"def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","id": "310","title": "GyZAaS"},"bin_id": "310","bought": "0","comments": "0","date": "1480263995.432155","def_image": "161127ecfd8e30b86f4456bfb19e782916a298.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "333","image": "161127ecfd8e30b86f4456bfb19e782916a298.jpg,161127e3b824c629a84561898e151386649acf.jpg","is_liked": true,"likes": "1","location": " ","modify": "1481994613.895438","price": "5.00","rank": "3.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "bEnZwE","type": "box","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"},{"bin": {"def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","id": "310","title": "GyZAaS"},"bin_id": "310","bought": "0","comments": "0","date": "1480263994.645202","def_image": "161127536c33fac6274ebc81134e5c352d7d1a.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "332","image": "161127536c33fac6274ebc81134e5c352d7d1a.jpg,16112701539f6f53de42a8a9940f9d31e5aab7.jpg","is_liked": true,"likes": "1","location": " ","modify": "1481994615.002504","price": "20.00","rank": "2.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "qTzKQb","type": "box","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"},{"bin": {"def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","id": "310","title": "GyZAaS"},"bin_id": "310","bought": "0","comments": "0","date": "1480262363.38135","def_image": "16112723f404a5ce1343b9b8b1668eb934b5b8.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "328","image": "16112723f404a5ce1343b9b8b1668eb934b5b8.jpg,161127986fb1b303b74a2c9e8d0019a0c3caed.jpg,1611272b6c0e7db82741538acbef20f1541e38.jpg,1611276ea98caa15914e0aa89aa36a6c19365d.jpg,16112767c91de0142343b1b1fc00800cad8b22.jpg","is_liked": false,"likes": "0","location": " ","modify": "1481994617.765555","price": "11.00","rank": "5.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "bVrCSY","type": "box","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"},{"bin": {"def_image": "1611279e1a27dc93dc4fcfa927d8c040ae24a5.jpg","id": "310","title": "GyZAaS"},"bin_id": "310","bought": "0","comments": "0","date": "1480263969.614861","def_image": "1611278288fa96bfa84fdcb922e050c41ddef1.jpg","geo": "43.7090808,-79.3988619","hidden": "0","id": "329","image": "1611278288fa96bfa84fdcb922e050c41ddef1.jpg,16112771cf20fecede42058943d57af7544d01.jpg,161127408872ae44b2466ca4abefecf1bf1ba9.jpg,161127663daa76679a467aa002b8da7bb8d7f8.jpg,1611270e1d4a2349e9482b96d98206b16a7137.jpg","is_liked": false,"likes": "0","location": " ","modify": "1481994620.170168","price": "18.00","rank": "2.0","saveok": "1","security": "public","text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sit sane ista voluptas. Ratio quidem vestra sic cogit.","title": "QsBjjD","type": "box","user": {"f_name": "Marv","id": "6","image_id": "all_20161220_16b5df9258d945b0aad5a10d434313f5.jpg","l_name": "Rayov","name": "Ray Rayov","public": "0","username": "rahman@browzzer.com"},"user_id": "6","views": "0"}],"ok": 1,"request_id": "af877b94-e264-44b8-9b81-3db60ba203a5"}

13. Groups

Groups are used to share items with multiple users. 

Creating a group

POST /user/<int:user_id>/follow/group
parameters: group_name

return {'ok': 1, 'group_id': <group_id>}

Adding users to a group

parameter: user_ids
user_ids can be one id or a group of user_ids separated by comma like group_ids=1,2,3,4

return {'ok' : 1}

Updating group name

POST /user/<int:user_id>/follow/group/<int:group_id>
parameters:group_name

return {'ok' : 1}

Getting group members

GET /user/<int:user_id>/follow/group/<int:group_id>
parameters:group_name

Example:
return {"count":2,"ok":1,"request_id":"faafe124-4f5f-46c9-948e-53cbf9446a60","users":[{"f_name":"MajidP2","id":"5","image_id":"all_20170104_204819cf5c654742a4ba553e9dfd5619.jpg","l_name":"Mobini","name":"MajidP2 Mobini","public":"0","username":"majidmobini2003@yahoo.com"},{"f_name":"tahere","id":"7","image_id":null,"l_name":"hoseini","name":"","public":"0","username":"taghiabadi1394@gmail.com"}]}

 

14. Adding company

In order to add a company, you need to call api_base_url/user/<user_id>/company with POST method and send the following data.
name, email, default_categry, location, geo, website, phone, image_id
In case of success, the system will send you {'ok': 1, 'id': <user_id>} and in case of failure, you will receive {'ok': 0}

So in short form:
POST /user/<user_id>/company
parameters: name, email, default_categry, location, geo, website, phone, image_id
return: 
true: {'ok': 1, 'id': <company_id>}
false:{'ok': 0}

15. Updating company

In order to update a company, you need to call api_base_url/user/<user_id>/company/<company_id> with PUT method and send the following data.
name, email, default_categry, location, geo, website, phone, image_id
In case of success, the system will send you {'ok': 1, 'id': <user_id>} and in case of failure, you will receive {'ok': 0}

So in short form:
PUT /user/<user_id>/company/<company_id>
parameters: name, email, default_categry, location, geo, website, phone, image_id
return: 
true: {'ok': 1, 'id': <company_id>}
false:{'ok': 0}

16. Deleting company

In order to delete a company, you need to call api_base_url/user/<user_id>/company/<company_id> with DELETE method.
In case of success, the system will send you {'ok': 1, 'id': <user_id>} and in case of failure, you will receive {'ok': 0}

So in short form:
DELETE /user/<user_id>/company/<company_id>
return: 
true: {'ok': 1}
false:{'ok': 0}

 

Make sure you use the free online HTML cleanup tool to avoid bad HTML practices on your website.