Hi,
I have this error when I try tu update json by query:
Exception is : com.shephertz.app42.paas.sdk.csharp.App42BadParameterException: {"httpErrorCode":"400", "appErrorCode":"1400", "message":"Bad Request", "details":"The Request parameters are invalid"}
UnityEngine.Debug:Log(Object)
RavrJsonVideoResponse:OnException(Exception) (at Assets/_RAVR_V1/Scripts/RavrJsonVideoResponse.cs:34)
com.shephertz.app42.paas.sdk.csharp.connection.RESTConnectorWWW:HandleException(String, App42CallBack)
com.shephertz.app42.paas.sdk.csharp.connection.<Execute>d__6:MoveNext()
com.shephertz.app42.paas.sdk.csharp.connection.<WaitForRequest>d__3:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
With this function :
private void ProcessMedias(string jsonString)
{
jsonMedias = JsonMapper.ToObject(jsonString);
mediaCount = jsonMedias["media"].Count;
Debug.Log("mediaCount " + mediaCount);
if (mediaCount >= 1)
{
// Loop through media
for (int i = 0; i < mediaCount; i++)
{
string regVideo = Regex.Match(jsonMedias["media"][i]["video"].ToString(), @".*\/([^/]*)$").Groups[1].Value.ToString().Replace(" ", "");
string currentVideo = Regex.Match(RavrDataManager.Instance.CurrentVideo, @".*\/([^/]*)$").Groups[1].Value.ToString().Replace(" ", "");
// If video url is same of selected video url
if (regVideo == currentVideo)
{
// Addition old value to new value (+1)
int currentLike;
int.TryParse(jsonMedias["media"][i]["liked"].ToString(), out currentLike);
value = currentLike + 1;
Query q1 = QueryBuilder.Build("video", RavrDataManager.Instance.CurrentVideo, Operator.EQUALS); // Build query q1 for key1 equal to video and value1 equal to current video url
Query q2 = QueryBuilder.Build("liked", value.ToString(), Operator.LESS_THAN); // Build query q2 for key2 equal to liked and value2 less than new value
Query query = QueryBuilder.CompoundOperator(q1, Operator.AND, q2);
// Call storage to update value for key "liked"
storageService.UpdateDocumentByQuery(RavrConstant.dbName, RavrDataManager.Instance.CurrentCountryName, query, jsonString, callBackUpdate);
return;
}
}
}
}
What is wrong ?
my json:
{"media":[{"id":"1","isWtfVideo":"false","title":"Child Climbs Historic Human Tower","price":"0","description":"\"null\"","liked":"5","isHotelVideo":"false","cityName":"\"null\"","image":"http://s3.amazonaws.com/ravrmedia/Spain/Child Climbs Historic Human Tower.jpg","thumb":"http://s3.amazonaws.com/ravrmedia/Spain/Child Climbs Historic Human Tower.jpg","video":"http://s3.amazonaws.com/ravrmedia/Spain/Child Climbs Historic Human Tower.mp4"},{"id":"2","isWtfVideo":"false","title":"City Guide of Barcelona","price":"0","description":"\"null\"","liked":"5","isHotelVideo":"false","cityName":"\"null\"","image":"http://s3.amazonaws.com/ravrmedia/Spain/City Guide of Barcelona.jpg","thumb":"http://s3.amazonaws.com/ravrmedia/Spain/City Guide of Barcelona.jpg","video":"http://s3.amazonaws.com/ravrmedia/Spain/City Guide of Barcelona.mp4"},{"id":"3","isWtfVideo":"false","title":"Hot Air Balloon Flight Spain","price":"0","description":"\"null\"","liked":"5","isHotelVideo":"false","cityName":"\"null\"","image":"http://s3.amazonaws.com/ravrmedia/Spain/Hot Air Balloon Flight Spain.jpg","thumb":"http://s3.amazonaws.com/ravrmedia/Spain/Hot Air Balloon Flight Spain.jpg","video":"http://s3.amazonaws.com/ravrmedia/Spain/Hot Air Balloon Flight Spain.mp4"},{"id":"4","isWtfVideo":"false","title":"Michelin Chef Susi Diaz at La Finca restaurant","price":"0","description":"\"null\"","liked":"5","isHotelVideo":"false","cityName":"\"null\"","image":"http://s3.amazonaws.com/ravrmedia/Spain/Michelin Chef Susi Diaz at La Finca restaurant.jpg","thumb":"http://s3.amazonaws.com/ravrmedia/Spain/Michelin Chef Susi Diaz at La Finca restaurant.jpg","video":"http://s3.amazonaws.com/ravrmedia/Spain/Michelin Chef Susi Diaz at La Finca restaurant.mp4"},{"id":"5","isWtfVideo":"false","title":"Rafting Spain","price":"0","description":"\"null\"","liked":"5","isHotelVideo":"false","cityName":"\"null\"","image":"http://s3.amazonaws.com/ravrmedia/Spain/Rafting Spain.jpg","thumb":"http://s3.amazonaws.com/ravrmedia/Spain/Rafting Spain.jpg","video":"http://s3.amazonaws.com/ravrmedia/Spain/Rafting Spain.mp4"},{"id":"6","isWtfVideo":"false","title":"Timelapse City of Arts and Sciences","price":"0","description":"\"null\"","liked":"5","isHotelVideo":"false","cityName":"\"null\"","image":"http://s3.amazonaws.com/ravrmedia/Spain/Timelapse City of Arts and Sciences.jpg","thumb":"http://s3.amazonaws.com/ravrmedia/Spain/Timelapse City of Arts and Sciences.jpg","video":"http://s3.amazonaws.com/ravrmedia/Spain/Timelapse City of Arts and Sciences.mp4"}]}