I'm using API platform with VichBundle to store file on the back side and React Native on the Front side.
I've followed the documentation of API platform and the upload part is working well, but I don't know how to download the document.
When I make a GET request I have the entity with the url of the file but I can't do a GET request with this url because there is no route to this file.
Can somebody give me an exemple of how to download file with api platform and Vichbundle.
Thanks
If you are following Api Platfom's documentation your files should be uploaded to your project's ./app/public/media/ folder and available making an HTTP GET request to http(s)://<yourdomain>/public/media/<filename>.<extension>. Just open the URL in your browser.
To get the exact url query yout API for me mediaObject information (for example, /api/media_objects/{id}) and check the contentUrl property.
Related
I am uploading bulk files using Dropbox .NET API.
I want that after uploading the file how to get a complete path or URL like - "https://www.dropbox.com/work/Apps/*****/testinng234/1.mp3". So that I can able to use this link directly.
Please suggest me the best way and share some code.
I am trying to use the GitHub API documented in https://developer.github.com/v3/repos/contents to read the content of a file. According to the document, it is to use "GET /repos/:owner/:repo/contents/:path". So I am trying to figure out how to actually use this API.
I am using Postman to test this API. For example, the owner name is "babybee", the repo name is "test_repo", what's the complete url for this? I tried "/repos/babybee/test_repo/contents/release/release_info.json" and obviously it doesn't work. Let's say, if the file path is "release/release_info.json" under root path, what would the actual complete url be for it to be working?
For the owner babybee, repo test-repo and file release/release_info.json, to get the contents, you should be using the API as below:
https://api.github.com/repos/babybee/test-repo/contents/release/release_info.json
I am getting the following response when requesting for Swagger doc in a Web API project,even the same response getting from Azure.
Can any one help me to get the Swagger UI.
Perhaps try to request the Swagger-UI through a different url, eg.../swagger/index.html.
I am not working with .NET here and I have no Idea about your setup, but did you (for example) copied swagger-ui resources to your webdir?
It looks like you are calling swagger interface directly and not swagger-ui (which is something different).
https://swagger.io/swagger-ui/
from Swagger-Ui Documentation:
Step 1: Go to the GitHub repository of the Swagger UI project
Step 2: Clone or download the zip file of the repository
https://github.com/swagger-api/swagger-ui
Usage
Step 1: Go to the folder containing the Swagger UI project in your local machine
Step 2: Open the dist folder
Step 3: Run the dist/index.html file on a browser or place the dist folder inside your server.
Step 4: The Swagger UI will now be live in the browser, with the default rendering of the Swagger Petstore. The JSON specification of the Swagger Petstore can be found here - http://petstore.swagger.io/v2/swagger.json
Note: Please remember that to load a specification and execute the UI’s try out requests, you would need to have enabled CORS (read below)
Step 5: You can mention the YAML or JSON path of any existing specification hosted on a server in the field on the top navigation bar.
The correct URL for the UI would be https://localhost:44390/swagger/ui/index
Check if swagger is configured to use any custom route or prefix. In this case the UI URL would be url:port/route-prefix/index.html. Route prefix empty = url:port/index.html.
What is the best practice to implement file uploads using Restler framework?
I like to have a API call that get the file save it in CDN and return back the CDN file URL to the caller. What is the best way to implement it?
File upload to CDN using our API
This requires two steps, first is to get the file on the API server.
add UploadFormat to the supported formats
Adjust the static properties of UploadFormat to suit your need
From your api method use $_FILES and move_uploaded_file to get the file to the desired folder. This step is common for any php upload process.
Now that you have the file on the server
Upload it to CDN. You can use any means provided my your CDN. It can be ftp or using some SDK to do the upload
Construct the CDN url and return it to the client
I need to open a HTTP link to the webserver which my air app is talking to but I don't want to hard-code the webserver URL into the Flex code. If I can get the endpoint URI then I can work from there. I'm using GraniteDS in case that is relevant.
import mx.messaging.config.ServerConfig;
ServerConfig.getChannel(CHANNEL_ID).uri;