Encoding a dictionary in URL Encoding - dictionary

I'm trying to attach a payment source in Stripe. To do so, I want to directly pass payment info. This is documented here. If you read description of source parameter, you'll understand my requirement.I want to attach dictionary of params to source param.
My question is how should I attach the params like object, account_number etc. which are supposed to be a dictionary under source param
PS: I'm trying to hit this api using Postman

I just found out a way of doing it. params are attached in the following format.
Request Type: POST
and to attach a source param with dictionary format, param is source[object], source[account_number] etc.

Related

Passing Parameters to a post httpweb request in asp.net for vb net code

Hi guys actually I am new to asp.net and had a task to do. I wast to call a api in post method with certain input paramater and in return I get gst address details. The input is as follows:
This is the purpose of this api:
This Service returns GST details (Address,OwnerName,Pincode,etc.)
**Link**=www.mylink.net/gstdata/gst
**method**= post
**input parameters**=> modid,key,gst (All are string types)
I provide gst no and in return gets the address.
Service Output parameters:
**Parameters Possible Values**
**code** 200,400,500
**status** FAILURE/SUCCESS
**error** string
**data** 1.values (map - key=column_name ,value=column_value)
**uniq_id** string
How do I get these values using HttpWebRequest parameter in vb net code? Please help
I would use
Dim WC as new WebClient
Dim HTML as string = WC.downloadstring("http://example.com/GetAdres?of=John")
Now you will have the Actual HTML of your service output. to further process it, we will need a little more information.
It is not clear to me how the service output is actually formatted, for this we need an example in raw HTML. can you please PASTE the actual Source code of the WebPage to me? the real source in source code, do not copy the document itself.
Security note
do not send the pincode... keep it on the server, and send the pincode to the server instead when it needs to be compared.

How to pass any URL to an APIFY task?

There is a box to configure the "Start URL" in APIFY, but what happens if i don't know the start URL and it depends of my user input? I would like to be able to pass a variable URL to "Start URL"
Configuration of Start URL in APIFY:
I want to pass any URL automatically through an APIFY task and then scrap it.
I tried to make it automatically through Zapier, in the configuration is possible to select the URL input and pass it to APIFY, but finally it stops the task because is not able to read the format passed. Data out log from Zapier:
I think that APIFY probably lets configure dynamic input URL's but by my beginner level, probably there is something that scapes from my knowledge.
I want to be able to pass variable URL's to be scraped by APIFY.
You can check how input looks like in JSON format using Editor/JSON switcher on the top of input configuration.
After you switch to JSON you can easily check the structure of startUrls.
If you want to override startUrls for example in Zapier integration you can do it using Input JSON overrides field in Run Task Apify<>Zapier action.
You can override input same way using API to run the task, where you need to pass JSON as POST payload of the API request.
If you want to read more about Apify<>Zapier integration you can check article Scrape single URL using Zapier.

How can the JsonProvider be used with URLs requiring authentication?

I want to do something very similar to what's shown in the docs for FSharp.Data:
The URL I'm requesting from though (TFS) requires client authentication. Is there any way I can provide this by propagating my Windows creds? I notice JsonProvider has a few other compile-time parameters, but none seem to be in support of this.
You don't have to provide a live URL as a type parameter to JsonProvider; you can also provide the filename of a sample file that reflects the structure you expect to see. With that feature, you can do the following steps:
First, log in to the service and save a JSON file that reflects the API you're going to use.
Next, do something like the following:
type TfsData = JsonProvider<"/path/to/sample/file.json">
let url = "https://example.com/login/etc"
// Use standard .Net API to log in with your Windows credentials
// Save the results in a variable `jsonResults`
let parsedResults = TfsData.Parse(jsonResults)
printfn "%A" parsedResults.Foo // At this point, Intellisense should work
This is all very generic, of course, since I don't know precisely what you need to do to log in to your service; presumably you already know how to do that. The key is to retrieve the JSON yourself, then use the .Parse() method of your provided type to parse it.

How to exclude imported URL parameters when they have no value?

I've installed the Swagger Importer, which is just great. It saved a lot of setup time. It also enumerated all of our APIs optional parameters, which is also good because I don't have to reference docs; however, I don't want GET and POST requests to send the params when I haven't explicitly set the values. Is there a way to configure PAW to not send URL Params when they have no value? One option is to just duplicate an item and then prune the list, but it seems reasonable that there should be a way to simply ignore items that aren't set.
For example:
Don't GET:
http://domain.com/api/v1/users?maxResultCount=&isActive=true
(because maxResultCount is optional and not set)
Instead, do GET:
http://domain.com/api/v1/users?isActive=true
The current release, Paw Version 3.0.7 (Retail) now provides checkboxes on URL parameters.

How to set the format of a reply to a REST service in BW6

I'm new to BW6 (v.6.3.1) and I'm playing around with it's REST features.
Currently I'm building a very simple echo service to figure out how it processes parameters etc.
One of the things I've noticed is that I can specify multiple Reply Client Formats, namely XML & JSON. But I can't find how I can specify what output to use in the actual reply.
Currently I've setup the following Resource Service Path:
/echo/{param}.{format}
I want to use the format parameter to drive the output I'll be getting. So
/echo/printme.xml
would result in
<messageBody>printme</messageBody> (or something to that extent)
And
/echo/printme.json
would result in
printme
I've tried several approaches, splitting the flow based on the contents of "format" but to no avail. If I have JSON checked as the Reply Client Format it will reply with JSON. Only if XML is the only Reply Client Format checked the reply will output XML. BW handles the rendering of either JSON or XML transparently.
So, how can I tell BW to output in either XML or JSON when both are selected as a Reply Client Format?
Edit:
Using the swagger UI I figured out how I can drive this behavior. By specifying the following header:
curl -X GET --header "Accept: application/xml" "http://localhost:8080/echo"
As per the documentation
Select the Invoke REST API pallette, you can choose the type(either request or response) as shown below:
If you click on it, there are three options JSON, XML and Custom. If you want to choose other than json and xml then choose Custom.
Custom(For RequestType) : Custom: to override the Content-Type value in the Input tab, select CUSTOM and provide the value in the Input tab.
Custom(For ResponseType): to override the Accept header value in the Input tab, select CUSTOM and provide the value in the Input tab.
Below is the Input tab where you can override when type is Custom:

Resources