_getByUrl

Returns File data based on given URL.

Parameters

url

File ID number.

base64

An optional parameter which, if set to 1, changes the File's data string in a successful return to a base64 format.

Example

FM_api('File_getByUrl',[
    'url'=>'files/0/683084/bc188e826790da0e9313d51487da1c25'
  ]
);

On Success

On Default, the result will be similar to this:

{
    "id":"427230",
    "filename":"suppliers.csv",
    "type_id":"683085",
    "description":"",
    "cdate":"2023-11-12 15:30:17",
    "notes":null,
    "owner_id":null,
    "meta":"{
        \"user_id\": \"92447\"
        }",
    "name":null,
    "type_enum":"0",
    "last_edited":"2023-11-12 15:30:17",
    "url":"files\/0\/683085\/43f8f0ba191a7fd4c58c94c5b375f7e0",
    "customer_readable":"0",
    "file_last_edited":"2023-11-12 15:30:17",
    "deleted":"0",
    "ddate":"0",
    "storage_type":"0",
    "storage_instance":"0",
    "filesize":"279",
    "data":"Id,Name,\"Account Number\",Phone,Email,Website,\"Tax Number\",\"Contact Name\",\"Street Address 1\",\"Street Address 2\",Town,Region,Country,Postcode,Notes,\"Hold Status\"\n398092,\"Supplier<img onerror=\"\"console.error('supplier')\"\">\",,,,,,,,,,,,,,\"On Hold\"\n398096,test,,,,,,,,,,,,,,\"On Hold\"\n"
}

If the parameter "base64" is given a value of 1, the data string becomes a base64 format:

{
    "id":"427266",
    "filename":"suppliers.csv",
    "type_id":"683116",
    "description":"",
    "cdate":"2023-11-26 15:19:50",
    "notes":null,
    "owner_id":null,
    "meta":"{
        \"user_id\": \"92447\"
        }",
    "name":null,
    "type_enum":"0",
    "last_edited":"2023-11-26 15:19:50",
    "url":"files\/0\/683116\/ca82b90b90eca5c2947b10d060f1c50e",
    "customer_readable":"0",
    "file_last_edited":"2023-11-26 15:19:50",
    "deleted":"0",
    "ddate":"0",
    "storage_type":"0",
    "storage_instance":"0",
    "filesize":"279",
    "data":"SWQsTmFtZSwiQWNjb3VudCBOdW1iZXIiLFBob25lLEVtYWlsLFdlYnNpdGUsIlRheCBOdW1iZXIiLCJDb250YWN0IE5hbWUiLCJTdHJlZXQgQWRkcmVzcyAxIiwiU3RyZWV0IEFkZHJlc3MgMiIsVG93bixSZWdpb24sQ291bnRyeSxQb3N0Y29kZSxOb3RlcywiSG9sZCBTdGF0dXMiCjM5ODA5MiwiU3VwcGxpZXI8aW1nIG9uZXJyb3I9IiJjb25zb2xlLmVycm9yKCdzdXBwbGllcicpIiI+IiwsLCwsLCwsLCwsLCwsIk9uIEhvbGQiCjM5ODA5Nix0ZXN0LCwsLCwsLCwsLCwsLCwiT24gSG9sZCIK"
}

On Failure

If the "url" parameter is not set:

{"error":"missing or invalid parameter: url"}

If the "url" parameter's value does not match the URL of an existing File:

{"error":"no such file"}

Last updated