AcrCloud Not able to upload audio file - acrcloud

Getting below error even we are passing title in request body
{
"name": "Unprocessable entity",
"message": "Lack field:title",
"code": 0,
"status": 422
}
Any Help will be appreciable.

You need to fill up the title field. Which is required.
please refer to this example code
https://github.com/acrcloud/webapi_example/tree/master/RESTful%20service

Related

SuiteCrm Rest API: JSON Body attributes throws error when calling POST or PUT

I'm using postman in order to call SuiteCRM REST API.
I tried to call this endpoint
PATCH http://{{suitecrm-url}}/Api/V8/module
and i've added this payload to the body (Content-Type: Application/Json):
{
"data": {
"type": "Accounts",
"id": "3a3ae651-d509-2508-7dc4-5be2e51cc96b",
"attributes": {
"name": "name with space"
}
}
}
When the request is executed SuiteCRM gives this response:
{
"errors": {
"status": 400,
"title": null,
"detail": "The option \"attributes\" with value array is invalid."
}
}
I found out that the problem was the whitespace in the value: when i tried to use the value "namewithspace", it worked.
Anyone has any idea how to solve this problem ?
Thanks in advance
I found out this issue on github that resolved my problem:
https://github.com/salesagility/SuiteCRM/issues/6452
In short to make it work i had to modify the file in
/Api/V8/Params/Options/Fields.php
and replace this line
const REGEX_FIELD_PATTERN = '/[^\w-,]/';
with
const REGEX_FIELD_PATTERN = '/[^\w-,\s\]/';
The person mentioned in github:
this is just for temporary fix and not upgrade safe

Facebook API - Can't update adset targeting's geolocation by zip codes

I'm trying to update my adset's targeting location to include 2 zip codes 85233 and 85224 but facebook keeps returning an Unknown error.
My request is
https://graph.facebook.com/v2.11/[ADSET_ID]
targeting={ "geo_locations":{"zips":[{"key":"US:85233"},{"key":"US:85224"}]}}
access_token=[ACCESS_TOKEN]
Response:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "EA9s0p59E9h"
}
}
Please let me know the correct way to do this?
UPDATE: I have tried to update adset geolocation by lat and lng but the same error happened.
{
"geo_locations":{
"custom_locations":[
{
"radius":30,
"latitude":30.1519297,
"longitude":-97.8338758
}
]
}
}
Can you try to use "/v2.4/" and check whether it returns a proper response?
Because it seems like a FB API bug. Check this: https://developers.facebook.com/bugs/486654544831076/

How to fetch comments with Facebook Graph API from comments plugin

I am trying to get all comments from my website.
I have found this method in plugin FAQ:
https://graph.facebook.com/v2.6/?fields=og_object{comments}
&id=<YOUR_URL>
&access_token=<YOUR_TOKEN>
But it neither corresponds to API reference (there's no field named comments in returned OpenGraph object), nor actually works. So I managed only to fetch amount of comments, but not actually their contents. Is it possible to do so?
The code referred to in the FAQ appears to be for v2.6 of the API, and so may be superceded.
I get comments from the Comments Plugin with the following.
First I get the Facebook Graph ID for the URL the Comments Plugin is operating within:
https://graph.facebook.com/v2.8/?id=<<YOUR_URL>>
&access_token=<<YOUR_TOKEN>>
This returns a response like this:
{
"og_object": {
"id": "<<OBJECT_ID>>",
"description": "<<OPENGRAPH_DESCRIPTION>>",
"title": "<<OPENGRAPH_TITLE>>",
"type": "article",
"updated_time": "2017-02-08T13:53:48+0000"
},
"share": {
"comment_count": 0,
"share_count": 0
},
"id": "<<YOUR_URL>>"
}
We then take that Open Graph Object ID and plug it into this:
https://graph.facebook.com/v2.8/<<OBJECT_ID>>/comments?summary=1
&filter=stream
&order=reverse_chronological
&access_token=<<YOUR_TOKEN>>
You'll get an object with a data property which will be an array of comments.
Testing for URL Provided by OP
https://graph.facebook.com/v2.8/
id=http://pdffiller.com/6962253&access_token=[REDACTED]
Returned
{
"og_object": {
"id": "1195506680497732",
"description": "Fill w9 fill out online 2014-2017 form irs instantly, download blank or editable online. Sign, fax and printable from PC, iPad, tablet or mobile. No software. Try Now!",
"title": "2014-2017 Form IRS W-9 Fill Online, Printable, Fillable, Blank - PDFfiller",
"type": "website",
"updated_time": "2017-02-08T12:08:37+0000"
},
"share": {
"comment_count": 0,
"share_count": 24
},
"id": "http://pdffiller.com/6962253"
}
Note the comment_count is zero, hence why no comments are returned by the Graph API

Getting attachments from Facebook conversations

I currently use the Facebook Graph API to get a inbox conversation. Most of the messages look like this:
{
"id": "1452301718360191_1407164668",
"from": {
"id": "10203840837848742",
"name": "Øyvind Knobloch-Bråthen"
},
"message": "Some message",
"created_time": "2014-08-04T15:04:28+0000"
}
However, some of the messages in the conversation are images, and they are represented like this:
{
"id": "1452301718360191_1407164668",
"from": {
"id": "10203840837848742",
"name": "Øyvind Knobloch-Bråthen"
},
"created_time": "2014-08-04T15:04:28+0000"
}
So basically what is different is that the message is gone. But since there is no mention of the attachment, or url to the image or anything else I can use, I'm not able to display the image in my app.
So my question is: How can I get a hold of the image (or url to the image). Hopefully it will be available in some way when I have the message ID.
With Graph api V2 the egde to retrieve inbox messages is /id/conversations
id is eitheir a user id or a page id
Each conversation message with attachment should return an "attachments" field.
Then for each message with attachment you should query the url https://api.facebook.com/method/messaging.getattachment?mid=message_id&access_tokes=your_access_token
Note that it does not work with graph api v2.1. Unless you curl the query

Facebook Credits Invalid State Transition Error

I am using Github sample code for the Facebook Credits (callback.php and index.php) but its giving me the below error.. anybody have any solution???
"Order::update_order called with invalid state transition:3 -> 0"
Thanks..
Hard to answer without seeing the code you're using, but the response you send should look like this:
{
"method": "payments_status_update",
"content": {
"order_id": ORDER_ID,
"status": "settled"
}
}
ORDER_ID should be replaced by the order id sent from fB with the request.
There were incorrect examples out there that showed:
{
"method": "payments_status_update",
"content": [{
"order_id": ORDER_ID,
"status": "settled"
}]
}
but the second one doesn't work. Check to make sure you're not sending content as an array.