Comments (6)
data/download as a URI or embedded base64 data? The former is probably better (fewer bytes to download)
from plone.restapi.
As URI. We might want to support embedded base64 data in future versions (maybe with framing).
from plone.restapi.
The current serialization for a File
looks like this:
{
"@id": "http://nohost/plone/document.pdf",
"@type": "File",
"title": "My PDF document",
"UID": "abef59538b3749debad950c3c5d35224",
"...": "...",
"file": "http://nohost/plone/document.pdf/@@download/file"
}
So a Named[Blob]File
field gets serialized directly to its regular Plone download URL (as currently documented in the Serialization chapter).
I would propose to change the serialization to something that is slightly more in line with the format used for deserialization (upload):
{
"@id": "http://nohost/plone/document.pdf",
"...": "...",
"file": {
"filename": "document.pdf",
"content-type": "application/pdf",
"size": 65536,
"download": "http://nohost/plone/document.pdf/@@download/file"
}
}
That way, clients would have the necessary information to render a decent download link, including icon, filename and size without doing a second request.
The contract would then be that the client can do a GET
request to the URL specified in download
, with the same credentials, and will get back a response with appropriate Content-Disposition
, Content-Length
, and Content-Type
headers as indicated in the metadata.
The same principle could probably be applied to images scales.
from plone.restapi.
@lukasgraf you proposal looks good to me. It is essential that serialization/deserialization use the same structure. I guess from a HTTP spec perspective it would be correct if the client would send a GET request to "http://localhost:8080/Plone/document.pdf/@@download/file" with Accept "application/pdf" header. Though, since it works without the Accept header in Plone as well I guess we don't have to be pedantic about it.
from plone.restapi.
@tisto I agree, this would be the proper behavior. But since Accept: */*
or no Accept header at all would also happen to work, we might just phrase this as a recommendation to the client / description of how the server is expected to behave in the docs.
I'll start working on this (and Images) then, PR coming up.
from plone.restapi.
Closed by #115
from plone.restapi.
Related Issues (20)
- Add remote_url(getRemoteUrl) to link content-types in navigation HOT 4
- Include release notes in Plone 6 Documentation
- Authentication error messages from PAS Plugins aren't returned by the restapi HOT 1
- restapi double parameter is broking code. HOT 8
- In content that uses the plone.blocks behavior, it is not possible to add fields to SearchableText with "plone.app.dexterity.textindexer" HOT 6
- Community Forum App Icon Not Filling Correctly. HOT 1
- Add plone.app.discussion control panel
- Types control panel does not allow to enable/disable discussion for a content type
- Implement SummaryDiscussionListingTemplate to fix Discussion url in listings HOT 1
- Documentation of event content type does not return a timezone
- NoneType' object has no attribute 'getProperty': when searching users HOT 1
- @querystring shouldn't list userids
- Test with Plone 6.1 HOT 1
- Require plone.app.iterate on test extras
- Require plone.app.upgrade in test extras
- @aliases endpoint should allow to filter by how an alias has been added (automatically, manually)
- @aliases endpoint should support filtering by date (from, to) HOT 4
- @aliases endpoint should allow to upload/download all aliases and allow to download filtered aliases as CSV file
- No way to determine whether next/ previous should be used from a content response HOT 1
- Translate error messages in EmailSendPost
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plone.restapi.