Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[SOLVED] Need Help With Raw Data Export

Discussion in 'Unity Analytics' started by Macellomatik, Jun 14, 2016.

  1. Macellomatik

    Macellomatik

    Joined:
    Mar 10, 2014
    Posts:
    4
    Hi, I'm having some trouble trying to use the Raw Data Export feature.

    I'm not really good with curl and html requests, so I'm probably doing something wrong...
    I'm using cURL for windows and I've written this command in the cmd line:

    curl -g^
    --user "UNITY_PROJECT_ID":"API-KEY"^
    --request POST^
    --header "Content-Type: application/json"^
    --data '{"startDate":"2016-05-20","endDate":"2016-06-12","format":"tsv","dataset":"custom"}'^
    https://analytics.cloud.unity3d.com/api/v2/projects/UNITY_PROJECT_ID/rawdataexports

    Where UNITY_PROJECT_ID and API-KEY are the values I got from the analytics dashboard.

    I get a html page titled "We're sorry, but something went wrong (500)" as response.

    Am I doing something wrong?

    Thanks for your help!
     
    Last edited: Jun 15, 2016
  2. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    413
  3. Macellomatik

    Macellomatik

    Joined:
    Mar 10, 2014
    Posts:
    4
    Thanks for the reply,
    I'm sorry but I did a mistake while writing the post, I was using the UNITY_PROJECT_ID already.
    I'm editing the post to avoid confusion.
     
  4. kentunity

    kentunity

    Unity Technologies

    Joined:
    Sep 16, 2014
    Posts:
    55
    Hi @Macellomatik,

    We're working on getting a more detailed error message instead of just a 500 error.
    Regarding your curl request, can you try removing the "-g" and also the new lines.
    So it should look like this:

    Code (JavaScript):
    1. curl --user UNITY_PROJECT_ID:API-KEY --request POST --header "Content-Type: application/json" --data '{"startDate":"2016-05-20","endDate":"2016-06-12","format":"tsv","dataset":"custom"}' https://analytics.cloud.unity3d.com/api/v2/projects/UNITY_PROJECT_ID/rawdataexports
     
  5. Macellomatik

    Macellomatik

    Joined:
    Mar 10, 2014
    Posts:
    4
    Hi, and thank you for the help,

    I tried using the command that way but I got the same error.

    The exact command I used is (except for the *** obviously)

    Code (JavaScript):
    1. curl --user "0***5:1***4" --request POST --header "Content-Type: application/json" --data '{"startDate":"2016-05-20","endDate":"2016-06-12","format":"tsv","dataset":"custom"}' https://analytics.cloud.unity3d.com/api/v2/projects/0***5/rawdataexports
     
  6. willos

    willos

    Unity Technologies

    Joined:
    Jun 16, 2016
    Posts:
    1
    Hi @Macellomatik

    Our logs are showing a problem with the JSON data that you are sending. For some reason the received JSON blob does not have the expected double quotes around the keys and values.

    I tried copy pasting the command you pasted in your previous reply (replacing just the credentials) and it worked fine. However, if I strip out the double quotes from the JSON keys and values then I will get the same 500 error. Is it possible something on your end is stripping out the double quotes?

    Here's example of the correct JSON with double quotes around the keys and values:
    Code (JavaScript):
    1. {"startDate":"2016-05-20","endDate":"2016-06-12","format":"tsv","dataset":"custom"}
     
  7. usarin

    usarin

    Unity Technologies

    Joined:
    Jun 16, 2016
    Posts:
    2
    @Macellomatik We plan on supporting a webform to create requests, that would simplify the creation process.
     
  8. Macellomatik

    Macellomatik

    Joined:
    Mar 10, 2014
    Posts:
    4
    Hi everybody, and thanks for all the help.

    I've been able to find the issue with the Json Data: in Windows the single quotes are not allowed, and must be substituted with double quotes. Also the inner double quotes have to be escaped.

    The command I used to make it work was

    Code (JavaScript):
    1. curl --user "UNITY_PROJECT_ID:API_KEY" --request POST --header "Content-Type: application/json" --data "{\"startDate\":\"2016-06-1\",\"endDate\":\"2016-06-21\",\"format\":\"tsv\",\"dataset\":\"custom\"}" https://analytics.cloud.unity3d.com/api/v2/projects/UNITY_PROJECT_ID/rawdataexports
    Hope this can help others, and thanks again!
     
    erika_d likes this.