RGI
RGI

Reputation: 343

What is the best way to pass a set of parameters to a website?

I need to pass several parameters to a website (MVC web app built in VS2017) that in turn will be constructing a PDF that is returned to the viewer.

Something like this: http://mywebsite.com?strAssetID=E2BEB600&strUserID=59&strGIU=1

I've been told that this is only possible with an API (i.e. REST API)

So does the web app need to be a REST API? i.e. it can't be a simple hello world website?

Is there a better way to pass the parameters?

Upvotes: 0

Views: 35

Answers (1)

Peter B
Peter B

Reputation: 24147

If you already have an MVC Web App then it should be relatively easy to add an Endpoint to it (e.g. /api/pdf/get?<your params>) that does this. MVC has great support for API responses, see e.g. How to return a PDF from a Web API application

And unless you need hundreds of parameters, specifying the parameters in the URL as you did is the recommended approach.

I wouldn't know why you would consider a "hello world website" (or even what you mean by that...) if you already have a full-blown MVC Web App.

Upvotes: 1

Related Questions