0

DELETE multy attachments

let method := "DELETE";
let rid := text(this);
let teamid := first(select Settings).DatabaseTeam;
let dbid := first(select Settings).DatabaseID;
let tid := tableId(this);
let file := urlEncode(text(fileMetadata(this, last(split(text(item(files(this), 0)), "/"))).name));
let cont := "application/json";
let url := ---
https://api.ninox.com/v1/teams/{ teamid }/databases/{ dbid }/tables/{ tid }/records/{ rid }/files/{ file }
    ---;
let bear := "Bearer " + first(select Settings).'API-Key';
let response := do as server
        http(method, url, {
            Authorization: bear,
            'Content-Type': cont
        }, {})
    end;
if response.error then
    alert(text(response.error))
end

i have this code for delete one to one attachment . 

Sameone can help me for change this code for delete all attachments in one step

thanks

4 replies

null
    • Mel_Charles
    • 8 mths ago
    • Reported - view

    Have a look here

    https://forum.ninox.com/t/y4yymy7/workspace-not-being-recovered-where-images-are-held-deleted

    therr are various options

    including delete all attachments to a table record

    • Meritec_srl
    • 8 mths ago
    • Reported - view

    great!!! i finded  the solution ...... thks

    • Mel_Charles
    • 8 mths ago
    • Reported - view

    Can you mark post as aswered please

    • EXCELTROP SL
    • Oscar_Ramirez
    • yesterday
    • Reported - view

    The clause:

    let bear := "Bearer " + first(select Settings).'API-Key';

    Returns the error Unknown table 'Settings'. I don't find what's wrong with this.