Can't Flattr an auto submit URL via the REST API - flattr

When flattring an auto submit URL via the REST V2 API with this request
POST https://api.flattr.com/rest/v2/flattr
{"url":"https://flattr.com/submit/auto?user_id=myuserid&url=myurl"}
I get this error, although the URL works fine in any browser and redirects to the existing thing.
{
"error_description" : "The requested thing(s) could not be found",
"error_uri" : "http:\/\/developers.flattr.net\/api",
"error" : "not_found"
}
So either I'm doing something wrong, or the error message is wrong, or something else?

You might have a problem with url encoding. For this to work you need to URL encode first the autosubmit URL.
http://blog.flattr.net/2011/10/api-v2-beta-out-whats-changed/ becomes http%3A%2F%2Fblog.flattr.net%2F2011%2F10%2Fapi-v2-beta-out-whats-changed%2F
Then you need to URL encode the whole autosubmit URL if you want to send it as a regular POST request.
http://flattr.com/submit/auto?url=http%3A%2F%2Fblog.flattr.net%2F2011%2F10%2Fapi-v2-beta-out-whats-changed%2F&user_id=flattr becomes http%3A%2F%2Fflattr.com%2Fsubmit%2Fauto%3Furl%3Dhttp%253A%252F%252Fblog.flattr.net%252F2011%252F10%252Fapi-v2-beta-out-whats-changed%252F%26user_id%3Dflattr.
If you are going to send it with JSON you don't need to URL encode the flattr autosubmit URL. Instead you do like the example below.
{"url":"http://flattr.com/submit/auto?url=http%3A%2F%2Fblog.flattr.net%2F2011%2F10%2Fapi-v2-beta-out-whats-changed%2F&user_id=flattr"}
This means that part of the URL will be URL encoded two times if you do a regular POST request and if you will send the data as JSON URL encode only one time. And when you do POST request with JSON body you need to set the Content-Type to application/json to make it work.

I forgot to set the Content-type header for the request. It needs to say "application/json".

Related

How customize API url in Postman?

Is it possible to customize URL for client ?
In detail, currently working on API project where I need to give API url, suppose actual URL like this
https://XYZ.ie/TA/sdv/sbhdv/j/ksd/filter=%sdvnj3d'2343'
Now I don't wish to show the actually locations and parameters names, also the actual URL is to long. so I'm willing to customize like
https://example.com/j/sdvn='23423'
so client would call above URL and initial URL could trigger.
I tried by changing the current values of variable in postman, didn't work.
Also would like to ask, does postman token expires after certain period?

HTTP Request From Webflow to Twilio Body Format - Webflow Logic Integration

I'm trying to send an HTTP request from Webflow to Twilio so that when a user submits a form on Webflow, a text message is sent to the phone number provided. I'm using their new Logic feature to achieve this. I have my Twilio credentials set up, but I'm not sure how to configure the body of the request to include the "To" phone number. I keep getting an error. I can't include images here but here is what my request body looks like, has to be JSON format.
{
"Body": "Hey name username"! Thanks for subscribing!",
"From":"+18647400789",
"To": "+1phoneNumberProvided"
}
Any thoughts?
Think you need to set the phone number ID from webflow into the "TO" section on the request as a dynamic field. Not 100% sure to be honest.
So it seems like Twilio only accepts url-encoded format for the request body which is where you would put the To, From and Body fields. At the moment, Webflow Logic only allows JSON body so Twilio isn't compatible. I believe other messaging services like Bandwidth and MessageBird allow JSON body so those might work. However, these require business emails to sign up for so it's still not always the quickest solution :/

How to pull the token from Get request's response and input the same to Post request in JMeter for Rest API?

I am a beginner in JMeter, trying to perform load test to my Rest API. First, the Get request gets the access_token as below:
Then the following Post request runs with that authorization token to produce the Json, but I am missing something so the Post Request is failing as Authentication denied as below,
Added the Regular expression extractor to extract the token from the Get request's response as below:
Then storing it in the HTTP Header Manager in a variable as below
I am missing to link the value to the Post request, I dont know how to do it, please help.
In header manager, instead of access_token, the header name should be Authorization. Please reconfirm this with developer team / retry this same request in postman
The regex expression used should look something like this
"access_token":"(.*?)"
Also, another pro tip: because the response to getToken api call is JSON, you can use JSON Post Processor to extract the access_token by saying something like $.access_token. It is much clean way to process JSON object.

How do i get the csrf token from scenario 1 response using Karate framework?

I have application api url which has passed as Background with Basicauth. Using that i need to get an csrf token. I tried with responsecookies. Nothing is coming up.
Can you please let me know how to get the csrf token from that specific api. I am getting actual application response but not the cookies.
Please read the documentation and go through the demo examples. It depends on the response. There are 2 possibilities, cookie (or header) OR the response body itself (plain text or JSON / XML).
So it is up to you to extract it and then store it as a variable, and use it to build headers for all future responses.
Please refer to the demo example:
Given path 'signin', 'token'
When method get
Then status 200
And header X-CSRF-TOKEN = response
In this case, the token happened to be the entire response string.

Instagram oAuthException missing url

I am unable to make any /media/search calls to the Instagram api without getting errors.
In firefox, the endpoint
https://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&?access_token=VALID_ACCESS_TOKEN
(Where VALID_ACCESS_TOKEN, is a valid access token that works successfully with other api calls.)
I get the following output
{"meta":{"error_type":"OAuthParameterException","code":400,"error_message":"\"client_id\" or \"access_token\" URL parameter missing. This OAuth request requires either a \"client_id\" or \"access_token\" URL parameter."}}
I can't make sense of this error, since clearly, the access token is present in the url.
Could it be some weird character encoding issue?
Just a quick look at your URL and it looks like you have an extra ? in there before the access_token parameter.
https://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&access_token=VALID_ACCESS_TOKEN
The first ? tells it to accept parameters, and then each param is separated by &. You shouldn't need any more ?'s and they may actually cause it to parse incorrectly.