URL: https://api.twilio.com/2010-04-01/Accounts/{{Twilio_ACCOUNT_SID}}/Messages.json
I am trying to send a Post request using Twilio "send SMS API" in Postman. When I run the request I encounter:
{
"code": 21604,
"message": "A 'To' phone number is required.",
"more_info": "https://www.twilio.com/docs/errors/21604",
"status": 400
}
I am using a free trial account. The "To" Number works fine in Twilio and is validated. I have x-www-form-urlencoded selected in the body of the Post Request in Postman.
It complains about To missing not it being not validated, check your request configuration in Postman.
The Authorisation section should look like this:
And the Body section like this:
Make sure that you call your key To (that is uppercase T and lowercase o) and that you provide a E.164 formatted number.
Related
I'm trying to get the live chat of the live stream:
https://www.youtube.com/watch?v=xHtuITYCqcM.
So for that, I made the URL:
https://youtube.googleapis.com/youtube/v3/liveChat/messages?liveChatId=xHtuITYCqcM&key=...,
and it returns the following:
{
"error": {
"code": 400,
"message": "page token is not valid.",
"errors": [
{
"message": "page token is not valid.",
"domain": "youtube.liveChat",
"reason": "pageTokenInvalid"
}
]
}
}
If anyone knows why is this happening, please help me.
I'm new to this platform, so if I missed anything, please tell me.
According to the official specification of the LiveChatMessages.list API endpoint, its request parameter liveChatId is defined as follows:
liveChatId (string)
The liveChatId parameter specifies the ID of the chat whose messages will be returned. The live chat ID associated with a broadcast is returned in the liveBroadcast resource's snippet.liveChatId property.
Consequently, passing to this endpoint the respective stream's video ID -- xHtuITYCqcM -- is incorrect.
You'll have to invoke, as specified above, the LiveBroadcasts.list API endpoint, passing to it the request parameter id set to your stream's video ID -- that is xHtuITYCqcM -- by means of an URL like this one:
https://www.googleapis.com/youtube/v3/liveBroadcasts?id=xHtuITYCqcM&part=snippet&fields=items.snippet.liveChatId&access_token=$ACCESS_TOKEN
where $ACCESS_TOKEN is the access token obtained upon running to successful completion an OAuth 2.0 authentication/authorization flow.
Note that the OAuth flow is actually required (an API key does not suffice), because:
Authorization
This request requires authorization with at least one of the following scopes (read more about authentication and authorization).
Scope
https://www.googleapis.com/auth/youtube.readonly
https://www.googleapis.com/auth/youtube
https://www.googleapis.com/auth/youtube.force-ssl
Also note that above I used the fields request parameter for to get from the API only the info that's of actual use (a good practice).
I send a request to https://www.googleapis.com/batch/youtube/v3, but I get a 404 anyway. Perhaps I am sending the request incorrectly, but most likely the endpoint is not working.
As well as, I use Postman to test with next creds:
1. POST request to https://www.googleapis.com/batch/youtube/v3.
2. Set "Content-type" header to multipart/mixed.
3. Add raw text body with as HTTP:
GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id=2222222&key=* HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=UTF-8
GET https://www.googleapis.com/youtube/v3/channels?part=snippet&id=1111111&key=* HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=UTF-8
Any suggestions for NodeJS?
YouTube Data API version 3 does support batch processing only of the following form:
Batch processing – The v3 API supports one of the batch processing use cases that the v2 API had supported. The v3 API's channels.list, channelSections.list, guideCategories.list, playlistItems.list, playlists.list, subscriptions.list, videoCategories.list, and videos.list methods all support an id parameter, which can be used to specify a comma-delimited list of IDs (video IDs, channel IDs, etc.). Using those methods, you can retrieve a list of multiple resources with a single request.
According to the docs, in case of Channels.list API endpoint, you're able to batch several calls, since, the id property accepts multiple channel IDs in one go:
id (string)
The id parameter specifies a comma-separated list of the YouTube channel ID(s) for the resource(s) that are being retrieved. In a channel resource, the id property specifies the channel's YouTube channel ID.
Note that the API provided me with the following response when asking the Videos.list endpoint to produce info for 64 videos in one go (even only 51 produced the same response):
ERROR 400: Bad Request
{
"error": {
"code": 400,
"message": "The request specifies an invalid filter parameter.",
"errors": [
{
"message": "The request specifies an invalid filter parameter.",
"domain": "youtube.parameter",
"reason": "invalidFilters",
"location": "parameters.",
"locationType": "other"
}
]
}
}
Therefore this API endpoint does not accept more than 50 IDs. It's very much presumable that the others will function the same way.
On my website I have a contact form which when submitted, creates a new service desk ticket. It makes the following rest api call:
https://jira-housters.atlassian.net/rest/servicedeskapi/request (with appropriate Accept and Authorization request headers)
{
"serviceDeskId": "1",
"requestTypeId": "1",
"requestFieldValues": {
"summary": "Housters Contact from Justin Test (Web)",
"description": "test message"
},
"raiseOnBehalfOf": "myemail#mydomain.com"
}
Before this worked completely fine, however a few days ago it started erroring:
{"errorMessage":"Your request could not be created. Please check the fields have been correctly filled in. Please provide a valid value for field 'Raise this request on behalf of'","i18nErrorMessage":{"i18nKey":"sd.validation.request.creation.failure.required.field","parameters":["Please provide a valid value for field 'Raise this request on behalf of'"]}}
This makes no sense, as it's complaining about the raise request on behalf of field when I clearly have it specified. What gives?
raiseOnBehalfOf should have the customers accountId not email.
You can create a customer using:-
-> https://your-domain.atlassian.net/rest/servicedeskapi/customer
-> Get the accountId from the response.
My goal is to take a text message sent to Twilio #, POST that information to my platform (ServiceNow). I believe my issue is that ServiceNow Script API can only receive content-type = [application/json, application/xml, text/xml] and so I get an error response invalid content type.
Looking at Twilio debugger, I don't see any explicit parameter called content-type. Any insights on what I might do here?
Response:
{
"error": {
"message": "Invalid content-type. Supported request media types for this service are: [application/json, application/xml, text/xml]",
"detail": null
},
"status": "failure"
}
Twilio developer evangelist here.
When Twilio sends a webhook for an incoming message the request is formatted as application/x-www-form-urlencoded.
If you are unable to find a way for ServiceNow to accept application/x-www-form-urlencoded you could try using a Twilio Function to translate the data to JSON and send it on to your endpoint.
Let me know if that helps at all.
I am hitting the Outlook Office 365 API through Postman. I tried to create a draft reply message using this URL:
POST https://outlook.office.com/api/v2.0/me/messages/{message_id}/createreply
The body contained:
body: {
"Comment": "Sounds great! See you tomorrow."
}
but I got the following error:
{
"error": {
"code": "RequestBodyRead",
"message": "The parameter 'Comment' in the request payload is not a valid parameter for the operation 'CreateReply'."
}
}
I have used this call based on the documentation.
This issue also exists for create a draft reply all message and create a draft forward message.
This is because you're placing comment within the body, it should stand on it's own. From this documentation:
POST https://outlook.office.com/api/beta/me/messages/AAMkADA1MTAAAAqldOAAA=/createreply
Content-Type: application/json
{
"Comment": "Fanny, Randi, would you name the group if the project is approved, please?"
}
Note that it is {"comment": "string"} and not body:{"comment": "string"}.