error when creating a new Sub-company through the API

  • 1
  • Problem
  • Updated 1 year ago
  • In Progress
  • (Edited)
When submitting a request to create a new Sub-company with the following body according to the documentation:

{
    parentId: '8eda746d-341a-4e86-ac3b-c614a8fd81b1',
    data: {
        name: 'Test',
        timeZoneOffset: -300
   }
}


I get a 500 error back with the following message in the server logs:

Can not instantiate value of type [map type; class java.util.LinkedHashMap, [simple type, class java.lang.String] -> [simple type, class java.lang.Object]] from JSON String; no single-String constructor/factory method (through reference chain: com.risevision.core.api.v1.EndpointRequestBody["data"])


My guess is that I am missing some required fields under `data`, but the documentation says that only `name` is required.
Any help is appreciated.

Thanks!
Leo
Photo of Leonardo Ferreira

Leonardo Ferreira

  • 144 Points 100 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Mike Thomas

Mike Thomas

  • 1,282 Points 1k badge 2x thumb
Hello Leo,

Thanks for reporting this. I would like to confirm you are using the Chrome browser? 

Regards,
Mike Thomas
Photo of Leonardo Ferreira

Leonardo Ferreira

  • 144 Points 100 badge 2x thumb
I just ran into the same issue with other APIs as well, such as `Presentations`.
Photo of Mike Thomas

Mike Thomas

  • 1,282 Points 1k badge 2x thumb
Hello Leo,

Thanks for letting us know. We don't directly support developer functions unless there is an error in our API, which doesn't appear to be the case here. This is documented in our Developer Documentation here, and I would recommend reviewing that as it may help with your application. Also, someone in our community may be able to assist you. 

Regards,
Mike Thomas
Hello Leo,

I think you need to change the way you are making the request to the api. The right way to do it is like the following where the parent company id is passed as url parameter
POST https://rvaserver2.appspot.com/_ah/api/core/v1/company?parentId=8eda746d-341a-4e86-ac3b-c614a8fd81b1
{
  data: {"name":"My Company",
         "timeZoneOffset": -300
        } 
}

Could you please try that and let me know if something doesn't work?

Cheers
Photo of Leonardo Ferreira

Leonardo Ferreira

  • 144 Points 100 badge 2x thumb
Thanks Rodrigo! I will try that.
Photo of Leonardo Ferreira

Leonardo Ferreira

  • 144 Points 100 badge 2x thumb
That worked Rodrigo! Thank you very much for your help!