API Post Data to Middleware - api

Anyone know how I can test posting data to this url? I was given the link by the IT supervisor and trying to have the data posted to the following link by submitting the following form. He said it would accept anything I send it

Could could do this via curl:
curl -X POST -d "data=anything_i_send_it" http://powersource.braindongle.com/lead-manager/lead/new/omgpost/sessions/
Or using another HTTP tool like Hurl.it
Or using a Chrome extension like Postman or REST Console.

Advanced Rest Client is an easy way to do it. It's a free chrome extension that can form http requests with data.

Related

JMeter testing for the url which contains # as path param

I have REST API which takes the username as a path parameter like this - app/users/{username}.
As per the business requirement, the username can be an email address as well.
Application is developed and we can test using postman, curl etc., by encoding the URL. But when we use JMeter to test the same API,
We are not able to send the encoded URL using JMeter. To demonstrate the problem, I created a webhook site(https://webhook.site/3c84998f-ecbb-4cee-a1e1-7c7ae059a209/testjmeter%40jmeter)
and requested as below.
"GET https://webhook.site/3c84998f-ecbb-4cee-a1e1-7c7ae059a209/testjmeter%40jmeter"
This resulted in a webhook as below
"https://webhook.site/3c84998f-ecbb-4cee-a1e1-7c7ae059a209/testjmeter#jmeter"
But we want the output like below which we could accomplish by postman or curl.
curl --location --request GET 'https://webhook.site/3c84998f-ecbb-4cee-a1e1-7c7ae059a209/testjmeter%40jmeter'
Please help how I need to prepare my JMeter script which produce the same output as above (in curl)
I cannot reproduce your issue using latest JMeter 5.4
Not sure what does your "webhook" do, however in a sniffer tool like Wireshark request paths are exactly the same for curl and JMeter and no %40 doesn't get decoded into #
If you're capable of sending your request successfully via curl or postman you should be able to record it using HTTP(S) Test Script Recorder - this way you will get appropriate JMeter configuration.

Hitting API endpoint with GET verb and parameter value=40

I need to hit this endpoint as part of an assessment, I have tried having a looking online and I would ideally like to do this just by using the browser console.
This is my task:
Your task is to write some code (eg. console, html form, javascript, python etc.) to hit 2 API endpoints. You can use any language, framework, tool or library. The result of each endpoint will give you instructions on how to proceed. The first endpoint is /api/Step1 and requires a GET verb and a parameter value=40
I am really trying to understand how to do this but all of the things I have read have not worked.
Any help would be greatly appreciated.
[Postman]
http://i.stack.imgur.com/DA5Oq.png
You should make sure you get the idea of what an API is, and you can read this for the queries.
That said, you are looking to send a GET http request to the url /api/Step1?value=40. You can to this using a tool like Postman on Chrome, but there are other equivalents for other browsers.
If you are using osx/linux, you can look up the command curl on google to see how to do a GET request from the terminal, or check this SO question.
Sending a GET request is quite easy. You can use curl and php for example. If you google it, you can find examples.
Giving a parameter is easy like this: /api/Step1?value=40

Authenticating to Magento Rest API via Curl and token-based authentication fails

As all I want to do is connect to my own site, I should be able to ignore oAuth and do token-baseed authentication as per:
http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-token.html
My curl request looks exactly like:
curl -X POST "https://magento.host/index.php/rest/V1/integration/admin/token" \
-H "Content-Type:application/json" \
-d '{"username":"test#example.com", "password":"123123q"}'
The response I get is a HTML page from my own site that basically says 'page not found' I'm obviously going to the correct domain, but it seems something else in the URL is incorrect. Any ideas?
Am I using the wrong URL?
In version 1.9 you need to create a Guest endpoint. Then you don't need to use oAuth. You can see how to use it here: http://devdocs.magento.com/guides/m1x/api/rest/introduction.html
An authentication system that uses REST so that you do not need to actually track or manage the users in your system. This is done by using the HTTP methods POST, GET, PUT, DELETE. We take these 4 methods and think of them in terms of database interaction as CREATE, READ, UPDATE, DELETE.
There is no direct way to use REST token based authentication on the Magento 1.x version. You need to write this functionality to you for your own. I have write this functionality by using REST API and you can also follow this article for more details.
https://www.ipragmatech.com/magento-token-base-rest-api-for-authentication-and-authorization

import.io curl simple data integration

I want to get the simple api integration from https://import.io via curl. I created a magic api and struggle now to get the data.
Do I use the magic api on the browser, it works fine. But with curl I get a {"code":"NOT_AUTHORIZED"}. Obvious that the authentication did not work.
Here's my code
#!/bin/bash
login=foo#bar.com
pass=foobar
userid=foo-bar
apikey=1f2o3o4b5a6r
curl --user $login:$pass https://api.import.io/store/data/033fbe66-13b7-4cf2-ba9c-58183a567a6f/_query?input/webpage/url=https%3A%2F%2Fwww.zalando.de%2Flp-ons-wom-sale-cat-v1%2F%3Forder%3Dsale&_user=$userid&_apikey=$apikey
What am I doing wrong? And how do I get it run with curl?
I could get it running. Found https://github.com/import-io/bashtractor/blob/master/bashtractor.sh which solved my problem.

curl LinkedIn API

I obtained the oauth token and oauth token secret for the LinkedIn API via Python. I'd like to make some REST calls via curl now and I tried the following ;
curl -v "http://api.linkedin.com/v1/people/~" -d "oauth_token=xxxxxxxxxx" -d "oauth_token_secret=xxxxxxxxxxxxx"
I've used the LinkedIn API in Python but wanted to use in curl. Am I missing something here ?
Any suggestions in this regard will be highly appreciated.
Thank you for your help.
You need to sign the requests using OAuth - usually the best way to do this is to use a library (like you mentioned, the python library works well). You can scoop the HTTP traffic to see what additional headers are being sent. The developer portal at http://developer.linkedin.com has an overview of the OAuth stuff, but it'd be pretty tough to get a working implementation for Curl because each signature you generate will be different (based on timestamp).