Error 1400 when getting album.

0 votes

Hi,

I am getting errorValue : {"app42Fault":{"httpErrorCode":400,"appErrorCode":1400,"message":"Bad Request","details":"The Request parameters are invalid"}} . When trying to GetAlbum. My script for creating user works. I am running unity on windows. My Unity version is 5.3.4f1. Help would be greatly appreciated.  Here is the code used:

using UnityEngine;
using System.Collections;
using com.shephertz.app42.paas.sdk.csharp;
using com.shephertz.app42.paas.sdk.csharp.gallery;
using System;

public class Gallery : MonoBehaviour {
    AlbumService albumService;
    // Use this for initialization
    void Start () {
        albumService = App42API.BuildAlbumService();
        PhotoService photoService = App42API.BuildPhotoService();
        App42API.Initialize(my_own.API_KEY,my_own.SECRET_KEY);
    }
    
    void Update () {
        if (Input.GetKeyDown(KeyCode.A))
        {
            CreateAlbum();
        }
    }

    void CreateAlbum()
    {
        App42Log.SetDebug(true);
        albumService.CreateAlbum(userName, albumName, description, new UnityCallBack());
        
    }

    string userName = "Matti";  //Also tried with String value
    string albumName = "My Album";  //tried with String value
    string description = "Room album all of the pictures of the room";  //Tried with String
 
    class UnityCallBack : App42CallBack
    {
        public void OnSuccess(object response)
        {
            Album album = (Album)response;
            App42Log.Console("userName is :" + album.GetUserName());
            App42Log.Console("albumName is :" + album.GetName());
            App42Log.Console("Description is :" + album.GetDescription());
            App42Log.Console("jsonResponse is :" + album.ToString());
        }
        public void OnException(Exception e)
        {
            App42Log.Console("Exception : " + e);
        }
    }
}

asked Jun 2, 2016 in Unity by Matti Tuomi (16 points)

1 Answer

+1 vote
 
Best answer

Hi Matti,

Greetings!!!!!!!!

Please do initialization in first step before creating Object of AlbumService. You can change on code snippet written in start method like :

void Start () {

   App42API.Initialize(my_own.API_KEY,my_own.SECRET_KEY);
        albumService = App42API.BuildAlbumService();
        PhotoService photoService = App42API.BuildPhotoService();
    
    }

Let me know if you still face any issue.

Thanks

Vishnu Garg

answered Jun 2, 2016 by Vishnu Garg (674 points)
selected Jun 2, 2016 by Matti Tuomi
Thank you for fast response. That solved my problem!
Let me know if more queries are concern.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...