Postman how to use Get Requests by read URLs from various .txt files - url

I hopefully have a simple request but unable to do by myself due Postman's
file support behaviour.
Case:
Lots of people creating simple URLs for a maschine learning tool and pushing them into a database.
The URLs got just simple differencies of an count up ID Number to request the appropriate information.
However, at the end of the day we got lots of simple single textfiles each
with 1 single url line.
What I just wanna do is to push the whole folder into Postman to finally test all created URLs and save the rsult as json...hm
Postman does not support textfiles and yeah thats crackbrained but I dunno how?
Any idea is welcome?
Thanks a lot in advance
brgds

You can export a Postman's Collection and see how the requests in it are exported (The JSON Format of a request is to be noted).
Now you know the format of a request, you can create a script that'll just run through all your files and basically generate a request out of each URL and add that to the exported collection's JSON.
Finally, import the collection back into Postman and you'll have all the requests ready to be tested out.

Related

Asana - Rest API - Multipart/form image upload times out

I am working on a little tool to upload issues found during development to Asana. I am able to get and use post to create tasks etc, but I am unable to do a proper multipart forum upload.
When I run my image upload post request through an independent perl based cgi script I am getting 200's back and an image saved on my server.
When I target Asana, I get 504 gateway timeouts. I am thinking there must be something strict that the perl script is letting through but I have malformed in my request but I am hard pressed to find it.
Is there a web expert or asana expert out there who might be able to help shed some light on what might be missing.
Note the wireshark capture has an extra field. The Asana docs indicate a task field I have tried with and without that field since it is unclear if the task id encoded in the url satisfies that requirement.
I found the problem!
My boundary= had quotes around the value which was getting through on my cgi / apache setup but not for asana.

Ping/Post Form Handling with PHP?

I'm working with a company on lead delivery, and they sent me some info regarding a Ping Post form setup. I've built hundreds of HTML forms processed by PHP (ie. sending an email/etc), but never something that would Ping a url, then return a value. The value it returns is XML.
Here's the purpose of the process:
I send a lead (form data) using the form with a particular zip code
This company parses that info, decides if it wants to "buy" it
Returns XML saying "Approved" or "Denied"
If "approved", I then post the data, and if "denied", I can do whatever I want
What is a common PHP method for doing this? I can research the code and put something together, just need to know what structure or PHP methods would work?
Thanks in advance.
You should be looking into RESTful Web Services.
here's a few examples that might help you
http://markroland.com/blog/restful-php-api/
http://coreymaynard.com/blog/creating-a-restful-api-with-php/
I did not create these examples, just what I found on Google.
I used file_get_contents(url) to handle the posting. The url contains inputs from the HTML form added as a query string, and the response is in XML which gets handled with simplexml_load_file().
As far as I understand your question what you need is to make an HTTP POST request and parse the incoming XML data.
I would rather not use file_get_contents() on remote servers - there are some potential security issues and it was missing some features the last time I checked. I strongly recommend cURL for remote HTTP/HTTPS communication.
Depending on the API you are posting to you might be able to use the SOAPclient class, but from the look of the response you got all you need is XML parser or Simple XML.
Anyway if you just need to check if a certain keyword (like Approved or Denied) is present you can use a simple string matching like this
if(strpos($response,'<STATUS>APPROVED</STATUS')!==false){
//approved
}
...

http POST method for web server

I'm looking at HTTP POST method to create a web page.
I'm a tad unfamiliar with it, and was looking for some explanation on how this works.
I'm simply wanting to use their seemingly simplistic page for my own server needs.
My question is this, how does this curl link really work?
curl --data-binary #audio2.flac --header 'Content-type: audio/x-flac; rate=16000' 'https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&pfilter=0&maxresults=1&lang="en-US"'
So I got it to work by using curl, by sending a flac file as you can see, and it responds with
this JSon stuff
{"status":0,"id":"3b7853241a0dded048f84744cc1ab896-1","hypotheses":[{"utterance":"ice cream","confidence":0.88215643}]}
Please correct me if I'm wrong:
So I believe this is a post method as it has the ? mark with it to send the name value pair.
I have no idea how they got the link https://www.google.com/speech-api/v1/recognize
to only accept POST requests without having a script name like this at the end
https://www.google.com/speech-api/v1/recognize/scriptName.pl
How do I write something to accept a post request at that given page without a .pl or .py extension? How can I put it in a certain directory on the server.
In addition for my purposes can I also send a file back to them once I process / zip?
Any ideas on how to do that?
Thanks so much for your time and generous help!
It seems that if you use --data/--data-binary/--form that the request is POSTed.
I first totally misunderstood your question and though you wanted to know how to use the interface, but you got that working.
The serverside can be achieved by multiple means, totally depending on the infrastructure and software used.
With the Webserver apache for example, you could use Rewrite or something in a HtAccess file to obfuscate/change the requested file. So looking at the extension (or the absence of it) is not helpful.
Please also see various options mentioned here
Running PHP without extension without using mod_rewrite?
or
ForceType/htaccess file extension question - extensionless files?
to see how you could achieve the same.
Only accepting POST data is then again dependant on the programming/scripting technique you employ at your server side, PHP e.g. distinguishes between multiple superglobals like $_GET and $_POST.

Rails: How to process a file that was sent with curl

I'm trying to create a restful api capable of receiving a file.
http://leejava.wordpress.com/2009/07/30/upload-file-from-rest-in-ruy-on-rail-with-json-format/
talks of how to accomplish this simply.
Not being very used to rails or curl, I don't know how to formulate my curl call.
Could anyone help me. Explain how to use curl to send a file, and how to use rails to accept and store the file.
Note.. the file is a 10 meg zip file. For testing I called it.
C:\test.zip..
I've looked at tutorials, but they all seem to be web page based. They also all degrade to resizing pictures.. Like uploading and presenting images are the same topic.
You need to know a bit about how your server-side is expecting the data. If it is a http POST with multipart/form-data (which I think it is), then this will probably help:
curl -F "fileParam=#c:\test.zip" -F "param1=xxx" -F "param2=yyyy" http://my.server/post-service
This will use curl to post form-data (including a file) to the given url with the given parameters. You need to know the parameter names for the file and the other optional parameters, and you have to obviously get the URL correct to reach your service.
Hope that helps.

EBAY - Sending a file via http post?

I've a file I want to send to the ebay system to support the LMS.
All the samples I've found include the use of the API, but the environment I'm working in doesn't have the ability to use it (the api).
So I'm forced to send the file with an HTTP post. But the doc's seem lacking.
Has anyone constructed/found an example of a HTTP post that will send a given file.
EDIT:
Oh.. what I see in the samples I have found is an area that seems it's supposed to have the data, but in the sample, there's nothing I'd consider real data.
Are you talking about the file transfer service or the bulk upload service? Don't you just generate an xml document and post the url like in this example:
http://developer.ebay.com/DevZone/file-transfer/CallRef/uploadFile.html#Samples

Resources