Skip to content

Commit 7f3afbd

Browse files
authored
Update REST API.md
1 parent 9cba82a commit 7f3afbd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Documentation/REST API.md

+20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* [Store group](#store-group-api-reference)
1212
* [Copy file to local storage](#copy-file-to-local-storage-api-reference)
1313
* [Copy file to remote storage](#copy-file-to-remote-storage-api-reference)
14+
* [Authenticated urls](#authenticated-urls-api-reference)
1415

1516

1617
### Initialization
@@ -234,10 +235,29 @@ uploadcare.copyFileToRemoteStorage(source: source, target: "one_more_project", m
234235
}
235236
```
236237

238+
### Authenticated urls ([API Reference](https://uploadcare.com/docs/delivery/file_api/#authenticated-urls?utm_source=github&utm_medium=referral&utm_campaign=uploadcare-swift)) ###
237239

240+
This method allows you to get authonticated url from your backend using redirect.
241+
By request to that url your backend should generate authenticated url to your file and perform REDIRECT to generated url.
238242

243+
Redirect url will be caught and returned in completion handler of that method.
239244

245+
Example: https://yourdomain.com/{UUID}/
240246

247+
Backend redirects to: https://cdn.yourdomain.com/{uuid}/?token={token}&expire={timestamp}
248+
249+
```swift
250+
let url = URL(string: "https://yourdomain.com/FILE_UUID/")!
251+
uploadcare.getAuthenticatedUrlFromUrl(url, { (value, error) in
252+
if let error = error {
253+
print(error)
254+
return
255+
}
256+
257+
// value is https://cdn.yourdomain.com/{uuid}/?token={token}&expire={timestamp}
258+
print(value)
259+
})
260+
```
241261

242262

243263

0 commit comments

Comments
 (0)