i tried to work with marketplace. They said that "Working with the API consists of sending a request and receiving a response. To do this, you can use the console to the right of the method descriptions, the Swagger interface"
Also, the link of "Swagger interface" => https://api-seller.ozon.ru/docs/#/
looks like this:
I`m a little bit confused, because i expected, that this is the library, or smth like this.
Link swagger.json
it`s a page with to json setting(as i think), picture is pretty view of plain text on that page:
so, i have no swagger library, but have this json.
Question:
Can i make from this json Swagger project?
When you click on swagger.json (as you shown in image with red arrow) it will redirect you to another page, this page have json configuration.
Copy this json and open https://editor.swagger.io/ this link, and paste your json.
After that, there is an option on menu 'Generate Client' it give you a various options to generate your client in Angular, C# and so on
Related
I'm developing a new API using Slim Framework (v3).
I'm trying to integrate this API with Swagger UI, but when I click "Try it" button, Swagger generates the following link.
Example link:
http://localhost/api/public/contact?param1=1¶m2=2param3=3
It's correct if I don't use Slim, but a link for Slim API is like:
http://localhost/api/contact/1/2/3
What I want is that Swagger use a link to Slim API, how can I do to achieve that? I can't find a way to "translate" the link format.
I'm using Swagger-php for comments (annotations).
I hope you can help me. Thanks.
You have a couple different options.
First Swagger-ui won't show that link unless it's defined somewhere (i.e the basePath attribute) or left undefined. It sounds like there's something missing there.
Next, you can always override the basePath in your API like such:
window.swaggerUi.api.setBasePath('/api');
Which should take away the /api/public section.
It's a little difficult to debug without seeing your JSON or YAML swagger definition but those two techniques should get you over the hump.
I've been tasked with providing the backend for a news feed that will be used by our company apps. The feed will pull articles from our current website, which is built with ModX (evolution). So far, I've designed the feed to send JSON through a specified url containing the needed information. It's currently in the following format (using Ditto placeholders):
{
"title":"[+longtitle+]",
"description":"[+description+]",
"link":"[(site_url)][~[+id+]~]"
},
Here's my issue - the link I'm providing through the JSON (in the link tag) opens the full, desktop version of the page. Our current site is not responsive, and was not originally designed to handle mobile devices. We would like to open a small, clean page showing ONLY the ['content'] of that particular article. I'm looking for a way to link to a page showing only this content - no header, no footer, nothing.
I know that I could create a new page to handle all of this, but it needs to be dynamic. New articles are created regularly, and I'd like to avoid having to add another page to handle this for every article, while also making it simple for the writing team to integrate this feature.
One of my ideas so far is:
Pass a GET parameter to the URL "link" in the JSON - something like - www.mysite.com/article1?contentOnly=true. Then, in my article, detect this parameter in PHP and handle accordingly. I would need this snippet on each article written, so it may cause issues down the road if our staff writers forget to add it.
I haven't worked with ModX long, so I'm assuming there's a better way to handle this. Any ideas would be greatly appreciated. Please let me know if I need to provide more information.
I am not 100 % sure how you have done this, but here's my tip.
Don't use the resource itself to output the JSON. Doing this based on a GET-paramter will required the entire site to be uncached. Instead, use a single resource for the feed and supply the id/permalink there.
For example: mysite.com/feed?id=1, mysite.com/feed?latest or something like that.
Done this way, you could have an empty template with just the snippet that is parsing to JSON in it. This has to be uncached of course, but the rest of the site could be cached as normal.
I am trying to scrape a website for article titles, however this page only loads the five first titles and loads more when the user scrolls down the page (JSON calls more articles and injects into the page).
The web scraper that I built works perfectly, but only finds the first 5 default articles, and what I am trying to achieve is to load more than 5. Is there any way of achieving that using PHP and if you can explain me why/how it works I would really appreciate because I love to learn these things.
you can use chrome's network monitor to log the source of the ajax requests and then request those from your webscraper, but this really is a "make shift api" , and will brake if the site changes it's json format, you can use the php function json_decode to decode the json.
http://php.net/manual/en/function.json-decode.php
in order to first retrieve the data, you will have to use file_get_contents
http://php.net/manual/en/function.file-get-contents.php
but this will only allow GET
If you want more "advanced" options ( like POST ) you will have to look into cURL
http://php.net/manual/en/book.curl.php
I have a textfield in a component i am using. I want to implement autocompleter for that field. Also the autocompleter should fetch data from an array...I tried the autocompleter with mootools from the below link but it works when tested seperately but when i integrate it with joomla it doesnt work.
http://digitarald.de/project/autocompleter/
Can anyone suggest me what are the options i can go after to fulfill my requirement. ??? or wat could be the cause that its not working.
Using Jquery might result in conflict with mootools so havnt tried that option.....
Thank you for the reply...
Maybe your problem is that Joomla renders response as HTML not JSON. Try to open the URL which you use for autocompletion in browser and see page source.
How to render valid JSON or XML, you can read in Joomla Wiki, sections "Generating JSON output" and "Generating XML output" respectively
I would like to create a PHP application like FIREFOX "Poster" plug-in thisone
basically , I want to make a call to a url with post data, that will be the body of the URL.
(I want to send the contain of the body)
You're probably looking for curl.
Good luck with your project.