Import from a third party

Download an asset from a third-party application by providing a download URL and a target folder. You can also indicate asset metadata to save and specify retry mechanisms. Each attribute is defined in the table below.

ImportFromThirdParty: function (_oOptions, _fCallbackSuccess, _fCallBackFail)
+ _oOptions.DownloadUrl:
+ _oOptions.FolderID:
+ _oOptions.Headers:
+ _oOptions.SingleValueMetadata:
+ _oOptions.MultiValueMetadata:
+ _oOptions.ExternalID:
+ _oOptions.ExternalService:
+ _oOptions.SaveToFileName:
+ _oOptions.ForcedSubType:
+ _oOptions.DownloadRetries:
+ _oOptions.DownloadMinWaitBeforeRetry:
+ _oOptions.DownloadMaxWaitBeforeRetry:
+ _oOptions.ImportRetries:
+ _oOptions.ImportMinWaitBeforeRetry:
+ _oOptions.ImportMaxWaitBeforeRetry:

Request parameter

The Options object uses the following attributes:

AttributeTypeDescriptionDefault valueRequired
DownloadUrlstringThe download URL of the asset to import.undefinedyes
FolderIDstringThe record ID of the folder the asset will be imported to.undefinedyes
HeadersobjectHTTP headers of the API call.undefinedno
SingleValueMetadataobjectAPI names of single-value metadata fields. Values in this object are strings.undefinedno
MultiValueMetadataobjectAPI names of multivalued metadata fields. Values in this object are arrays of strings.undefinedno
ExternalIDstringThe ID of the asset in the third-party application.undefinedno
ExternalServicestringThe name of the third-party application.undefinedno
SaveToFileNamestringThe filename of the asset in the third-party application. This data is stored in the OriginalFileName field in Orange Logic.undefinedno
ForcedSubTypestringThe asset subtype to apply to the imported asset. When this attribute is undefined, Orange Logic applies the standard subtype based on the file type. For example, the Standard Image subtype is applied to image files.undefinedno
DownloadRetriesnumberThe number of download retry attempts.3no
DownloadMinWaitBeforeRetrynumberThe minimum number of minutes to wait before a download retry.100no
DownloadMaxWaitBeforeRetrynumberThe maximum number of minutes to wait before a download retry.1000no
ImportRetriesnumberThe number of import retry attempts.3no
ImportMinWaitBeforeRetrynumberThe minimum number of minutes to wait before an import retry.100no
ImportMaxWaitBeforeRetrynumberThe maximum number of minutes to wait before an import retry.1000no
Example
Utils.ImportFromThirdParty(
    {
        DownloadUrl: `https://mangovations.orangelogic.com/AssetLink/4ry6b3133j753w1a03nh3t8jpwspyx17.JPG`,
        FolderID: '2Y8TWAFUPL3',
        Headers: {
            'Authorization': `Bearer ABCXYZ123456`,
        },
        SingleValueMetadata: {
            "CoreField.Title": "Imported through call external API",
            "TestNameSpace.TestField": "Test value"
        },
        MultiValueMetadata: {
            "CoreField.Keywords": ["Keyword1", "Keyword2"]
        },
        ExternalID: "External123",
        SaveToFileName: `newfilename.jpg`,
        ExternalService: "OrangeDAM"
    },
    // Success callback function
    function (_sResp) {
        Log.Info('Downloaded and imported successfully: ' + _sResp);
    },
    // Failure callback function
    function (_sResp) {
        Log.Warn('Failed to import: ' + _sResp);
    }
);