on 12-08-2023 7:19 PM
Hello,
I use an ABAP backend based on an OData service with the "GetStream" method overridden to respond with PDF files generated in the backend.
That part works well! If I call the URL from SAP in the Gateway client:
sap/opu/odata/sap/MY_ODATA_SRV/myEntitySet(Key1='',Key2='')/$value
It shows the PDF file! 😄
The problem I am facing is that I don't know how to retrieve that file in Swift using the iOS SDK.
(I'm building an ONLINE app)
I attempted with this code, but it didn't work:
let oItem = MyODataSrvFmwk.MyEntity()
oItem.key1= "123"
oItem.key2= "123"
Task{
do{
let media = try await myOData.dataService!.downloadMedia(entity: oItem)
print(media)
}
catch{
print(error)
}
}
This code always ends up in an error.
Could you please help me with this?
On the other hand, I searched the documentation and found nothing.
I am using the documentation from:
https://help.sap.com/docs/btp-sdk-ios/sap-btp-sdk-for-ios/utilizing-odata-api?locale=en-US
Is there another one that is more complete?
If loadfing the entity first helps, that can be achieved with:
try await myOData.dataService!.loadEntity(oItem)
but perhaps if you share the actual error that you received, that would help, since just setting the key values in a new entity should work if the backend supports uses canonical URLs for accessing the media stream (as it appears to from the URL you provided).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
8 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.