Cant download a PDF from API

I really hope someone can help. I cant download a pdf from API.
I get a raw file that looks like this when i get it in the POSTMAN API.


And when I download it as PDF it looks fine. See below PDF.
Why cant I download it in the app like this and show it in the PDF reader or webviewer.

1 Like

Is this also what it looks like in the PDF Reader or WebViewer in Thunkable?

I’d imagine that Postman just doesn’t render the PDF file correctly.

1 Like

No there is nothing at all

1 Like

Any authentication required to connect to the API?

1 Like

Yes and I am sure that is working since I get a lot of other info from the api

1 Like

@domhnallohanlon There’s a much longer topic about this already. Perhaps this can be merged to it?

1 Like

@domhnallohanlon Yes sure. Please merged it with the old one. i dont know how to do that.
I get the status 200 but the response is empty?
It is very strange???
Do I have to get the proberty of the response or something like that???

1 Like

Can you send me the response you receive from your API call. I can’t reproduce it in my side but if you can provide the response as a file or in a sharable link so I can test it.

Sure but not sure how. Because when i download it from Postman i just download it as a normal PDF

1 Like

Was thinking if the Content-Type had anything to do with it???

image

Becaue in the docs it looks like it

1 Like

The text file you sent me as PM is actually a PDF file. Just change the extension from .txt to .pdf and you will be able to open it with any PDF viewer.

Yes but the problem is that the file i sent to you was saved from the postman api and not in the app. I dont get anything when I download it from the app

Part of the problem is that the demo url works perfectly but the url @funhall is using with authentication doesn’t return a valid value (my guess! We don’t know…). So the problem is not with the API and probably not with the JSON parsing either. The problem is that we haven’t seen a valid FULL url including authentication.

What are you meaning by URL with authentication. Is that not the Tokens that I have in the header???

Isn’t the same as this that I dont have in the Postman either??? And still I get the PDF file…
Maybe I am completly wrong and then I am so sorry.

It might be the same, I don’t know. I’ve never gotten an API call in Thunkable to work with anything more complicated than just including the API key in the url. The good thing about that is you can test it in a browser without Postman or Thunkable. But we couldn’t get to that step. So knowing it works in Postman but not in Thunkable… there’s a large gap there that could be filled by testing in a browser (without either tool).

But I’m not sure how to get there and I’ve been back and forth with you about this so many times in three different topics now that I’m out of suggestions. Maybe someone who has more experience with authenticating API calls in Thunkable will know.

1 Like

The authentication is clearly there in @funhall post number 10.

When you run the URL without authentication you get this

Therefore it won’t work without proper keys.

Yes I se what you mean. But I just cant see where i miss those keys. Because I can get everything else from the API. I have the two need Tokens also.
So where is it that they are missing???
I just cant figure it out…

1 Like

In Postman there is a header tab next to Authorization tab it says in your screen Headers (10) can you check it please. Most API keys are placed in the header of the API object structure.

like this

1 Like