logo

generatePermanentUrl

Use this method to turn an uploaded media file into a permanent, publicly reachable URL.
Normal media ids are only usable inside nandbox messages. A permanent URL can be used anywhere β€” an email, a web page, an external system.

Field
Type
Required
Description
method
String
Yes
"generatePermanentUrl"
file
String
Yes
The media file id returned when the file was uploaded.
param1
String
Optional
Free-form value of your own. It is echoed back in the response.
πŸ’‘ The server replies by echoing your entire request back with method changed to permanentUrl and a url field added. Any extra fields you include β€” such as reference or param1 β€” come back untouched, so you can use them to correlate the response.

Preconditions for API Functionality

The following tables outline the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
Action
Requirement
Description
Generate a permanent URL
The file must be known to the server
file must be a media id the server still has cached. An unknown id returns a file not found error rather than a URL.

Response

permanentUrl

Field
Type
Returned
Description
method
String
Yes
"permanentUrl"
url
String
Yes
The permanent URL for the file.
file
String
Yes
Echoed from the request.
param1
String
Optional
Echoed from the request, if you sent one.

SDK Mapping β€” generatePermanentUrl

SDK
Request Method
Response Callback
Java
api.generatePermanentUrl(file, param1);
permanentUrl(PermanentUrl permanentUrl)
JavaScript
api.generatePermanentUrl(file, param1);
permanentUrl(permanentUrl)
Python
napi.generate_permanent_url(file=file, param1=param1)
permanent_url(self, permanent_url)

Example

Request

json
{ "method": "generatePermanentUrl", "file": "5121960361126208", "param1": "invoice-1042" }

Response

json
{ "method": "permanentUrl", "url": "https://<nandboxBotServer>/permanent/5121960361126208", "file": "5121960361126208", "param1": "invoice-1042" }