APIs & Integrations

UmairKhan
Participant

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

I've been trying to attach a file from a URL in file manager and from file manager to deal through engagement. Previously, I was trying to do this process using this endpoint 

            /filemanager/api/v3/files/upload

but I wan't lucky enough to do my thing using that endpoint and posted a separate question for it on forum.

Now I'm trying to upload files from a url to file manager using this endpoint

           /files/v3/files/import-from-url/async

 

In response I'm getting

{"id":"AAAADKf-yqU","links":{"status":"https://api.hubspot.com/files/v3/files/download-from-url/AAAADKf-yqU/status"}}

Now I'm confused about this response because of two reasons

  1. status link in the response is not working and returning 404 Not Found
  2. If I've to attach this specific file with the engagement how can I do it because engagement takes attachment id of file not the id I'm getting in the response.

This is my code 

var options = {
  "method": "POST",
  "hostname": "api.hubapi.com",
  "port": null,
  "path": "/files/v3/files/import-from-url/async?hapikey=demo",
  "headers": {
    "accept": "application/json",
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
    console.log(body)
  });
});

req.write(JSON.stringify({
  access: 'PUBLIC_INDEXABLE',
  ttl: 'P3M',
  name: 'test image',
  url: "https://app.arrivy.com/api/files/AMIfv95pvfFG9Yvgxx2LVLTv7BFfIwsfRjeGXeQjUQYhlB3ul32Bwc86NYYR2uKcUXfv0KRoVwIwPCDy3sAaww3Msra-Kg4oZJsa9GgYVQIxjgNPMi1vRmmlnRQswrHQ2IDq3cRfGHY0Fcp62ocnsdq-d_772HWono9AyWYd6NOiAKbBhCUi95TYC0S74OPY6itN6owPt6MxU8TkuV1WR7UOgsVFVPjmjrt8ZVdHE1gF3Wi9epodApJ7Vgtswhhrfy7hqrCdXO5hsY2uTQtiXuTbu2SqYEurO8fOLBIbePjhjy4gmAyEiJuGgLYHcexNlUdRdWwwbjP68tgVgCanSDCfTmvWPhmwh9JPlykbunb194kfX2XQtWk",
  folderPath: 'docs',
  duplicateValidationStrategy: 'NONE',
  duplicateValidationScope: 'ENTIRE_PORTAL',
  overwrite: true
}));
req.end();

 

 

 

0 Upvotes
1 Accepted solution
UmairKhan
Solution
Participant

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

Thanks @Teun @dennisedson @TiphaineCuisset for your response. I've resolved my issue. It was related to filename not the folder path. If you don't mention extention(like .csv, .jpg, .txt) in your filename, you'll get an error on the status link found in response of /import-from-url/async Api.

View solution in original post

7 Replies 7
UmairKhan
Solution
Participant

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

Thanks @Teun @dennisedson @TiphaineCuisset for your response. I've resolved my issue. It was related to filename not the folder path. If you don't mention extention(like .csv, .jpg, .txt) in your filename, you'll get an error on the status link found in response of /import-from-url/async Api.

Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

Thank you for the update! Didn't even notice it, so good to keep in mind.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


UmairKhan
Participant

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

Hey @Teun I tried with folderId and still the url I got in the response giving me 404. Though my file get attached in the file manager by running the above mentioned script but the problem is to get the exact id of that file to attach it with the engagement.

0 Upvotes
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

@UmairKhan I think @dennisedson is giving you the answer, if you look at the docs the "folderPath" contains a / before the folder name. If that isn't working, could you try swapping the folderPath for a folderId parameter? That way, you know for sure that you have no issues with the relative path.



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


UmairKhan
Participant

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

Hey guys @himanshurauthan @DanielSanchez did you get a chance to look into my problem ? Actually I'm blocked and I'll be thankful if you suggest me some kind of solution to my problem. And thankyou @TiphaineCuisset for mentioning daniel and himanshu.

 

Best

Umair

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

@UmairKhan , wondering if the problem is as simple as the folder path needing a / in front of docs?

@Teun 👋, any thoughts here?

0 Upvotes
TiphaineCuisset
Community Manager
Community Manager

/files/v3/files/import-from-url/async returns link which is not valid

SOLVE

Hi @UmairKhan 

 

Thank you for reaching out.

 

I want to tag some of our experts on this - @himanshurauthan @DanielSanchez do you have any thoughts for @UmairKhan regarding this? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !