Logic App Http POST request UnsupportedMediaType error - http

I am getting the following error in my logic app:
{ "type": "https://errors-api.cloud.com/common/unsupportedMediaType", "detail": "Content type '' not supported", "parameters": null }
The following is my set up:
This works in Postman.
However, I noticed that in the Logic App if I add in a text in the Body section. For example "body". It works fine
The Body is not needed in the Postman so it's confusing to me why it needed in Logic app. Anyone come across similar issue?

Issue is with content-type in your case. I have tried to reproduce issue from my side, but I did not get any error. I have found similar issue like you in link
Also, can you add Accept as shown below in header request,
Accept:*/*
I have created logic app as shown below,
In Get Bearer Token, getting access token from authentication url,
Using access token from Get bearer token getting data from api as shown below,
The logic app ran successfully,

Related

Twilio API does not work with JSON but with MultiPartForms

im sending a POST request to this URL: https://verify.twilio.com/v2/Services/[REDACTED]/Verifications
and with that POST request I'm setting the required parameters in a JSON Object as the body.
My issue is that when I send the request with all the correct required parameters like this
{
"To": "[REDACTED VALID PHONE NUMBER]",
"Channel": "sms"
}
I get the following error.
{
"code": 20001,
"message": "Missing required parameter To in the post body",
"more_info": "https://www.twilio.com/docs/errors/20001",
"status": 400
}
If I try using Insomnia and setting the body to MultiPartForm and type in all my required parameters just like before it works. The issue is I cant use multipart forms and I need to use JSON, anyone have an idea why the API is acting like this?
Here is the API docs:
https://www.twilio.com/docs/verify/api/verification
After further testing, YAML and XML don't work either.
This answer isn't very satisfying, but this is how the API works. It would be best if you used content-type=application/x-www-form-urlencoded as it is also done in the documented samples.
It would be nice if it were explicitly mentioned somewhere like it was in the past.
Here's a suggestion then, build yourself a Node.js Twilio Function that takes in a webhook from Twilio, translates the content from application/x-www-form-urlencoded to application/json, and sends it on to your application

LinkedIn Posts API returns INTERNAL_SERVER_ERROR

Running into an issue when trying to call the Posts API.
I'm getting a list of the authenticated user's posts through https://api.linkedin.com/rest/posts?q=author&author=AUTHOR_URN (https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/posts-api?view=li-lms-2022-07&tabs=http#find-posts-by-authors) which worked yesterday but not anymore today.
I am convinced I changed something between then and now, but whatever I do I cannot seem to get the request to work anymore.
The error returned does not give me a lot of information either:
{
"message": "Internal Server Error",
"status": 500,
"code": "INTERNAL_SERVER_ERROR"
}
I also created a request to fetch images yesterday, which does still work:
https://api.linkedin.com/rest/images/ids=List(IMAGE_URN) (https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/images-api?view=li-lms-2022-07&tabs=http#batch-get-images)
URN I'm using for the /posts request is formatted as follows: urn%3Ali%3Aorganization%3A<REDACTED> (where <REDACTED> is the numeric author identifier).
Confirmed the headers are the same between the /posts request and /images request.
Headers for reference:
Authorization: Bearer ACCESS_TOKEN_REDACTED
X-Restli-Protocol-version: 2.0.0
LinkedIn-Version: 202207
Is there anything I'm missing here that I need to get my /posts request working?
Thanks in advance!
Talked to someone from LinkedIn support since the issue occurred for me. Their response:
It's possible that you were getting that error due to a small hiccup on our side at that time - This can happen when we deploy updates or fixes.
Since then I've not seen this happen anymore, so expecting this is the case. Closing as answered.

Receiving ERR_CONNECTION_REFUSED when trying to fetch autocomplete suggestions

I have an registered account with the here-api's and just today created a new apiKey, because we where still using the old authentication method.
No matter what authentication we use though, we receive an ERR_CONNECTION_REFUSED error when trying to access the suggestion.json-endpoint. Other endpoints work fine.
I.e. this request works fine:
https://geocoder.ls.hereapi.com/6.2/geocode.json?searchtext=200%20S%20Mathilda%20Sunnyvale%20CA&gen=9&apiKey={API_KEY}
but this fails:
http://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?query=Pariser+1+Berl&beginHighlight=<b>&endHighlight=</b>&apiKey={API_KEY}
using, the same API key obviously, with the aforementioned ERR_CONNECTION_REFUSED error.
What's also confusing me is that removing a character from the apiKey in the first request leads to a senseful response
{
"error": "Unauthorized",
"error_description": "ApiKey invalid. ApiKey not found."
}
Whereas doing this in the second request still just returns the ERR_CONNECTION_REFUSED error.
Could you please try to use https instead of http in your request as -
https://autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json?query=Pariser+1+Berl&beginHighlight=<b>&apiKey=apikey
As Example for Javascript is also using https and which is working.
https://developer.here.com/documentation/examples/rest/geocoding_suggestions

Authorization header not working Angular 5

I am consuming an JWT based API.
I am passing the Authorization header correctly (I mean in the code),
using headers.set('Authorization', 'token') and i am using the correct method which is GET.
When i serve the application (using ionic 3), i have the error 405 (Method Not Allowed), but the same request works when i use POSTMAN or i paste the code snippet (generated from POSTMAN) into the console.
Here's two captures of the working request (using code snippet from POSTMAN into the console) and the not working request (from the ionic app).
By the way, there is something weird about the authorization, i highlighted it in red.
If it is not a cors issue, you could try according to following code
const httpOptions = {
headers: new HttpHeaders()
.set('Authorization', 'Bearer ' +this.auth_token)
}
return this.http.get('http://xxxxxx00x:8080/api/clients',httpOptions);
On the top screen you have got request method OPTIONS not GET and response from the server is 405 Method not allowed not 401 Unauthorized or 403 Forbidden.
So the problem is not authorization but request method.
Looks like CORS issue.

invalid_grant error when attempting oAuth2 for Box API

I have been attempting to get access tokens for the Box API and am running into a persistent problem. I am following the steps listed on this page. I am able to do the first leg and get a security token from a request to
https://account.box.com/api/oauth2/authorize?response_type=code&client_id=MY_CLIENT_ID&state=security_token%3DKnhMJatFipTAnM0nHlZA
I am then doing a POST request to
https://www.box.com/api/oauth2/token?grant_type=authorization_code&code={CODE_FROM_PREVIOUS_REQUEST}&client_id{MY_CLIENT_ID}&client_secret={MY_CLIENT_SECRET}
I also am including the header
Content-Type: application/x-www-form-urlencoded
With all this I am getting back:
{
"error": "invalid_request",
"error_description": "Invalid grant_type parameter or parameter missing"
}
Is there something I am missing here? Thank you in advance, any help would be appreciated
You're not actually POST-ing the parameters since you've included them in the URL as query parameters. You should pass the parameters as part of the HTTP request body.

Resources