Web services post request playframework 2.0.4 - web-services

I'm trying to do a simple POST request to a google API from Play 2.0.4 using HTTPS
but I don't know how to post parameters.
I am using Java.
WS.url("https://myurl"). ... .post("application/x-www-form-urlencoded");
I think .setQueryParemeter is only for GET request.
Any help is welcome.
Regards

After looking around I found it.
WS.url("URL").post("param1=val1&param2=val2...");

Related

How to resolve 400 Bad Request error in Postman in a sample MEAN application

I am working on a sample MEAN application where in I have started to create the node.js related files and connected the same to MongoDB. I have create a POST call which sends the json to the DB. I tried to test the api using postman but not sure whats wrong, I have checked multiple times, the api throws bad request.Any help on this is much appreciated. Thanks.
Added the relevant route.js, app.js and contact.js files for reference in stackblitz link. Added error in postman for reference.
https://stackblitz.com/edit/node-mlodls?file=app.js
Resolved the issue using postman extension. Wondering why the API doesnt work in postman software and works in postman extension

AWS Signing request

I'm using amazon chime js sdk for generating pre-signed URL for connecting to the chime websocket. When I use new WebSocket() in js, everything works well: connection gets connected, session gets started, etc. But when I'm trying open the link via postman, or an addon for Chrome, or via JAVA, it drops the connection immediately, and the response is just "4401 UNAUTHORIZED", despite the fact that URL is 100% correct.
Can somebody consult me about this?
Might it be rejected, if the user-agent in URL, and in request is different?
P.S. Sorry if my explanation is a mess.
Wrote fully working code for signing URL in JAVA. Hope this will help somebody!

How to use AWS amplify API in postman?

I have to use below inbuild functions of APIs but how can I use that function to create dynamic sub domain?
It meant, what will be host name for that? and how can I pass request object?
POST /apps/appId/domains HTTP/1.1
what will be the Request URI for that?
https://docs.aws.amazon.com/amplify/latest/APIReference/API_CreateDomainAssociation.html
If anyone have knowledge about it and then please help me.
Thanks in advance

GraphQL Endpoint returns 400

I have a django app built with graphene and I have a problem running a simple POST query for the GraphQL endpoint, it keeps returning a 400 Bad request syntax.
but it should work since I don't have any problems running the query from the endpoint http://localhost:8000/graphql-dev
and I can't see any issues in the way I send the postman request.
I looked online for suitable solutions but couldn't find any that would help.
Any help/tips would be greatly appreciated.
EDIT:
I still didn't manage to see why I'm having this issue with postman, but here are some observations:
first, i changed the request to GET (since in graphql, query is for GET and mutation for POST - sorry, I missed that)
I tried the same request with postman (which didn't work) and with insomnia (which did)
with postman
with insomnia
What's weird is that if i check my django console the requests look the same.
EDIT2: okay, I figured it out...removing the Content-Type application/json did the trick. Now it works with postman as well.

What are the usage limitations of Bitly shortening API?

I've tried Bitly's shortening API to shorten some URL's and after signing up and getting a username/API key, I've been able to shorten URL's in my local computer. But once, the code got deployed to a test server, the shortening fails. Any idea on what could possibly the source for this, or how to track the problem?
Try using PostMan ( chrome ) or HTTP Requestor ( firefox / my preference ) to post the JSON request you are sending to the API, review the error code and see if it has any useful errors (http://jsonformatter.curiousconcept.com/ is nice for reviewing it ).
Alternatively if you have no UI in the server use a CURL request from the server.
What language are you sending this in by the way? I am assuming JSON (not XML) is being sent eventually? What kind of server is it? Could you post the error code please?
Best of Luck!