Advertisement:

Author Topic: A rest api server for osclass  (Read 10434 times)

jun283

  • Newbie
  • *
  • Posts: 3
A rest api server for osclass
« on: June 16, 2014, 12:46:19 pm »
I want to develop a mobile app for osclass. I need a api server. But I did not find. I think osclass need a API server. So I built this project.
This is a PHP REST API server for osclass. It is a very light-weight, easy to set up and get going.


https://github.com/jun283/aRestAPI4Osclass
« Last Edit: June 16, 2014, 12:48:09 pm by jun283 »

bengalliboy

  • Full Member
  • ***
  • Posts: 204
Re: A rest api server for osclass
« Reply #1 on: October 13, 2014, 02:29:47 pm »
Where do you stand on this? What help do you want?

Hussard (Madhouse)

  • Full Member
  • ***
  • Posts: 214
  • Outlaw web developer & padawan designer.
Re: A rest api server for osclass
« Reply #2 on: October 13, 2014, 02:41:49 pm »
Interesting !
Your code looks tidy. what about packaging it as a regular plugin (easier install & could have settings pages) ?

We started a plugin to get search results as JSON using the feed feature of Osclass. It is early work in progress but basically, it works like this :
Code: (php) [Select]
function mdh_api_search() {
$params = Params::getParamsAsArray();
unset($params["sFeed"]);

$params["location"] = str_replace(",","-",$params["location"]);
$params["location"] = str_replace(" ","",$params["location"]);
$data["url"] = osc_search_url($params);
$data["title"] = meta_title();
$data["results"] = getContent(getPath("search-results.php"));

header('Content-type: text/json; charset=utf-8');

echo (json_encode( $data));
}
osc_add_hook("feed_api", "mdh_api_search");

Don't know if this is the way to go.
« Last Edit: October 13, 2014, 02:43:23 pm by Hussard »

xunilman

  • Newbie
  • *
  • Posts: 5
  • Developer at BM Bazar - www.bmbazar.cz
Re: A rest api server for osclass
« Reply #3 on: October 13, 2014, 06:06:24 pm »
I'm developing REST JSON API too because I need mobile app for http://www.bmbazar.cz
It looks really nice, but I need to do PUT and DELETE requests!
I will help!!!

bengalliboy

  • Full Member
  • ***
  • Posts: 204
Re: A rest api server for osclass
« Reply #4 on: October 14, 2014, 04:33:36 am »
Thank you for your offer.  Please tell me what I can do to help.
I think we will need a design first. I can do some coding and database access etc.
I can also help in the design mock up
If we can talk over skype (bengalliboy) we can team up some task so we can achieve this.  Just add me on skype and we can go over the details.
I visited your site, it is really nice. I really was looking on the selection of the country flag that you have on the top right. Does it actually set the search and display for that specific country? Can you please tell little more on that and can you share some code so I can do the same? I want to do an olx type of city selection.
Many thanks again.
--Aftab
On the web:
KhansList.com

Hussard (Madhouse)

  • Full Member
  • ***
  • Posts: 214
  • Outlaw web developer & padawan designer.
Re: A rest api server for osclass
« Reply #5 on: October 14, 2014, 04:01:30 pm »
I'm willing to contribute too if you need.

Just let me know.

xunilman

  • Newbie
  • *
  • Posts: 5
  • Developer at BM Bazar - www.bmbazar.cz
Re: A rest api server for osclass
« Reply #6 on: October 15, 2014, 02:46:06 am »
...I really was looking on the selection of the country flag that you have on the top right. Does it actually set the search and display for that specific country? Can you please tell little more on that and can you share some code so I can do the same? I want to do an olx type of city selection...
Yes it is just searching in specific country - first I wanted to show search based on currency but couldn't find any info about it so then I figured out that it will be only for two countries and when somebody from Czech Republic is posting new ad, they would instantly choose CZK currency, not EUR - so after choosing CZ flag, it shows their currency..
Code: [Select]
<div class="vlajky">
    <a href="<?php echo osc_update_search_url(array('sCountry' => 'cz')); ?>"><div class="flag flag-cz"></div></a>
    <a href="<?php echo osc_update_search_url(array('sCountry' => 'sk')); ?>"><div class="flag flag-sk"></div></a>
</div>

My mobile devs started implementing our iPhone/Android apps with this API and I will try to help. I want to ask if there is already a function that shows URLs to pictures from ads in json? I mean in your API.

qaximor

  • Newbie
  • *
  • Posts: 15
Re: A rest api server for osclass
« Reply #7 on: December 12, 2014, 11:47:41 am »
Any updates on this? I am willing to pay for a fully functioning API.

xunilman

  • Newbie
  • *
  • Posts: 5
  • Developer at BM Bazar - www.bmbazar.cz
Re: A rest api server for osclass
« Reply #8 on: February 03, 2015, 08:32:09 pm »
Just to let you guys know that I didn't have much time for working on this API because had 2 more project to finish.

We wanted to outsource the work around this API to someone else but when they told us it will be around 300€ to finish authentication and PUT/DELETE requests, we declined and I'm back on this myself.. compiled a list of things that needs to be developed and will update you on this.

We will use forked project started by jun283.

First things first - we need to update our item GET method to include URL of images and we should get this working by implementing new function in RestDAO.php by querying 't_item_resources' table and returning it in getItem function under apiServer.php for GET /item/$id.

Then I'll move on to implement authentication, found this thread, where somebody tried to use already made functions by osclass developers to hash passwords and retrieve them, so I think this shouldn't take much time:

http://forums.osclass.org/development/need-help-with-password-encryption-process/

- Mike

bengalliboy

  • Full Member
  • ***
  • Posts: 204
Re: A rest api server for osclass
« Reply #9 on: February 04, 2015, 06:30:04 pm »
Have any one thought of using jquery Mobile to do this? I think it will be much faster and secured with the new technology.  I can offer my time if some one help me on the ui design

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: A rest api server for osclass
« Reply #10 on: February 04, 2015, 07:18:54 pm »
what is a rest api server? what is purpose? what will it do for osclass? (really interested) maybe I can help with ui  ???

xunilman

  • Newbie
  • *
  • Posts: 5
  • Developer at BM Bazar - www.bmbazar.cz
Re: A rest api server for osclass
« Reply #11 on: February 08, 2015, 10:08:48 pm »
Small update:

- added GET /items/:id/images method for getting image IDs by item ID
Example:
Code: [Select]
http://www.your-osclass-site.com/api/v0.1/item/1/images   - 's_path' - path to to folder where image is uploaded
   - 'fk_i_item_id' - ID of an item
   - 'pk_i_id' - ID of an image
so you can get together an URL for image by joining 'http://www.your-osclass-site.com' + 's_path' + 'pk_i_id' + '.jpg'

Updated in https://github.com/michaltakac/aRestAPI4Osclass

bridge

  • Newbie
  • *
  • Posts: 1
Re: A rest api server for osclass
« Reply #12 on: August 06, 2015, 11:05:21 pm »
Hi If any body working on post apis of osclass please let me know!!

For Get Apis See https://github.com/bridgecodes/apis

bengalliboy

  • Full Member
  • ***
  • Posts: 204
Re: A rest api server for osclass
« Reply #13 on: December 04, 2015, 06:54:28 pm »
Has any one work on a post and delete or modify rest API ? for it? If not can any of you volunteer to do this?

ala

  • Full Member
  • ***
  • Posts: 213
Re: A rest api server for osclass
« Reply #14 on: December 20, 2016, 02:40:57 pm »
Does anyone complete API for osclass for create android app and iOS ?