Support Forums - Classified Ads Script Osclass
Osclass plugin support => Rest API Plugin => Topic started by: [email protected] on November 10, 2023, 07:14:06 PM
-
I'm starting to explore API's and the one that interests me most is the Osclass API.
I've installed the plugin on a test site and created my test API key for all operations, Read, Insert, Update, Delete.
Tried some simple operations like reading region and other tables successfully, i have used postman and SoapUI and also some code to perform the tests.
Now i'm trying to explore additional types, objects and actions.
One specificaly i'm trying is to insert ads, so i went to the great help page on the plugin and looked for the insert type and add action of object item.
However i'm having some difficulty as i get 500 error for this API call.
I had the must add picture plugin activated but the result is the same with it deativated.
While exploring the help on the plugin i can't find the attributes that are required, but i believe it can be explored somewhere.
Can someone guide me on how should i use the API and where can i find the attributes to get into the add action, and other actions ?
Thanks
-
https://forums.osclasspoint.com/rest-api-plugin/post-new-ad-with-images/
You have postman request here
-
Thanks for the link and sorry for not finding :-)
I'll follow on this to understand how i can use the API.
-
The example is great and allowed me to test adding listings, thanks for that.
I now hit another problem. I added some custom fields (native osclass function, not plugin) that i use in some categories.
Can i use custom field in the API, and how ?
-
Go to your search page to that category, filter by custom fields.
You will see parameter names in URL for these fields.
-
Got it, thank you very much, probably will be helpful for other fields too.
Information and great tips make miracles :) i might even build something out of this.
It's already gone into my ESB and it's working :)
-
Cool
-
The example is great and allowed me to test adding listings, thanks for that.
I now hit another problem. I added some custom fields (native osclass function, not plugin) that i use in some categories.
Can i use custom field in the API, and how ?
@[email protected], were you able to add listings with pictures?
If yes, could you please share how you went about it?
Had installed this plugin months ago but couldn't figure out some of the API calls especially, posting listings with picture. Because of these limitations, we are unable to use the plugin.
Thank you very much
-
Sure, I'm still learning also and getting help so happy to help with what I know.
I'me using fusion-project.org so it's a bit different the way I present the code and also it's in python, but I'm migrating this part of the project to full PHP.
I'll convert the examples I have and post here the result and example that I have working.
Since I'm away I'll need some time but don't worry as I'll post it here.
Just for your guidance the reply from MB Themes earlier was a big help, and actually for the API we should have a sort of cookbook that other can look into and use as there examples.
https://forums.osclasspoint.com/rest-api-plugin/post-new-ad-with-images/
-
For the moment import the json file into your postman and select the body tab.
It's the same as the one shared on the link.
In the body you'll find the photos in the form data.
First delete the selected ones, they are from the author and do not existe in your laptop or server, and you'll get a file selector to add yours.
Hope this helps.
I'm still working on this but I'll post it here.
The cookbook would really be helpful, starting with simple examples for better understanding and afterwords moving forward to more complex ones :-)
-
If plugin require advanced coding experience, what you said is essential.
Its also expected you are able to check source code, parameters and its processing.
Using plugin without sufficient skills is like buying book without reading skills.
-
The example is great and allowed me to test adding listings, thanks for that.
I now hit another problem. I added some custom fields (native osclass function, not plugin) that i use in some categories.
Can i use custom field in the API, and how ?
@[email protected], were you able to add listings with pictures?
If yes, could you please share how you went about it?
Had installed this plugin months ago but couldn't figure out some of the API calls especially, posting listings with picture. Because of these limitations, we are unable to use the plugin.
Thank you very much
Regarding the post with photos i'm exploring with some that is running but still didn't updated the photo, although everything looks ok.
Since my code is python i don't know if it's useable here so I asked Bard to convert to php didn't have the time to test it, probably needs to be corrected, so attached the python.
-
I do not think path to photos is OK. Do not think photos will exists on same server when you trying to import listings.
-
Thanks, you are correct, naturally.
I'm simulating being on my laptop or being an external CRM to osclass, so the path will be local to those, there must be better ways to do it of course.
-
Sure, I'm still learning also and getting help so happy to help with what I know.
I'me using fusion-project.org so it's a bit different the way I present the code and also it's in python, but I'm migrating this part of the project to full PHP.
I'll convert the examples I have and post here the result and example that I have working.
Since I'm away I'll need some time but don't worry as I'll post it here.
Just for your guidance the reply from MB Themes earlier was a big help, and actually for the API we should have a sort of cookbook that other can look into and use as there examples.
https://forums.osclasspoint.com/rest-api-plugin/post-new-ad-with-images/
Alright. Thank you very much.
If you have any updates