Community Announcements have moved! To stay up to date, please join the new Community Announcements group today. Learn more
×I built a confiforms app where users can upload documents. To retrieve these, I query the data via the REST API and get the following content:
{
"total": 1, "list": {
"entry": [
{
"recordId": 121,
"createdBy": "heusch",
"created": 1755163242079,
"id": "18f26577-15e6-4023-8745-1c2302f7c39a",
"fields": {
"Fakultaet": "C",
"Email": "peter.heusch@hft-stuttgart.de",
"Matrikelnummer": 123456,
"Fullname": "Peter Heusch",
"FakultaetTest": "C",
"StudiengangFakC": "e25f9f73-d783-4aca-8cdb-57732c785d75",
"Praesentation": false,
"Nachname": "heusch",
"Studiengang": "Bachelor Informatik",
"Auslandssemester": false,
"BPSStatus": "default",
"Stellenbeschreibung": "[{\"fileName\":\"merkblatt.pdf\",\"id\":\"150409792\",\"contentType\":\"application/pdf\",\"version\":\"1\"}]"
},"ownedBy": "heusch"}]}}
However, to download the attachment "merkblatt.pdf", the URL is https://wiki.hft-stuttgart.de/download/attachments/150409791/merkblatt.pdf?version=1&modificationDate=1755163242128&api=v2, which is off by one. How do I get from 150409792 to 150409791?
Any help greatly appreciated
Hi @Peter
It is not off by one - the one in the URL is the id of the page where attachment is stored and an id in the JSON returned by ConfiForms API is the attachment id
Alex
Hi Alex,
indeed, my question was how to retrieve this info. As of now, I only see the following steps:
1) Query Page using curl:
curl https://site.hft-stuttgart.de/rest/confiforms/1.0/search/123456789/BetreutesPraktischesStudienprojekt
2) From the answer retrieve the ID:
"id": "18f26577-15e6-4023-8745-1c2302f7c39a"
3) Query all child pages using curl:
curl https://site.hft-stuttgart.de/rest/api/content/123456789/child/page
4) From the lengthy answer, find the id from point the answer to prefixed by storage 1)
{
"id": "987654321", <<<<< This ID is important!
"type": "page",
"status": "current",
"title": "storage_18f26577-15e6-4023-8745-1c2302f7c39a",
.....
etc. etc. etc.
}
5) Retrieve document using curl:
curl 'https://site.hft-stuttgart.de/download/attachments/987654321/merkblatt.pdf'
Is there any shorter way to do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This sounds a bit complex to me... you can access attachment's metadata and it's container with one request
https://YOUR_SERVER/rest/api/content/ATTACHMENTID?expand=container
You will get the page id it belongs to and could easily craft the download URL you want, or just use what is provided in the REST API call response
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter - Welcome to the Atlassian Community!
It's best to contact the vendor directly to get assistance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.