Gen2 API Question

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I am new to the Repliconnect API (Gen2), and still trying to figure out the basics, as the documentation seems rather limited.

When trying some of the example queries from the documentation in the test window, I am getting errors.

If I want to return the timesheet rows for the current timesheet of a particular user (or even the current user), how do I do that? I have found the TimesheetTimeRowAll query, but it returns an exception. Also, I am not seeing how to limit it to the current timesheet vs all timesheets ever created.

Thanks for any advice/suggestions!

Richard T
Photo of Townend, Richard

Townend, Richard

  • 12 Posts
  • 1 Reply Like

Posted 2 years ago

  • 1
Photo of Aashnee Kamboj

Aashnee Kamboj, Community Moderator

  • 1599 Posts
  • 109 Reply Likes
Hi Richard,

Please find below a sample query that we believe can help you in setting up the scenario:

[
  {
    "Action": "Query",
    "QueryType": "TimesheetByUserDateRange",
    "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
    "Args": [
      {
        "__type": "Replicon.Domain.User",
        "Identity": "2"
      },
      {
        "__type": "Date",
        "Year": 2016,
        "Month": 5,
        "Day": 8
      },
      {
        "__type": "Date",
        "Year": 2016,
        "Month": 5,
        "Day": 9
      }
    ],
    "Load": [
      {
        "Relationship": "TimeRows",
        "DomainType": "Replicon.Project.Domain.Timesheets.TimesheetTaskRow",
        "Load": [
          {
            "Relationship": "Cells"
          },
          {
            "Relationship": "Task"
          }
        ]
      }
    ]
  }
]

In case you have further questions around it, please feel free to let me know and I can have a support call arranged for you!

Thanks,
Aashnee Kamboj
Photo of Townend, Richard

Townend, Richard

  • 12 Posts
  • 1 Reply Like
Please see the follow-up question below!

RT
Photo of Townend, Richard

Townend, Richard

  • 12 Posts
  • 1 Reply Like
Thanks - this definitely sends me in the right direction.

RT 
Photo of Townend, Richard

Townend, Richard

  • 12 Posts
  • 1 Reply Like
Now I have a more interesting problem ... I successfully adapted this query to return the Client associated to the TimeRow as well as the task, and it is returning results almost as expected.

However, the one problem is that my timesheet has a mix of rows with "no client" project/tasks and client-related project/tasks. The first row is correctly returning the client details. The no-client rows are correctly returning "Null" as the client object. The problem is that the subsequent client-based rows are also returning "Null" as the client object.

The only work-around that I have found is to go through the task > project > projectclients > client chain of relationships, but that seems like a very long way around to something that appears to be trivially simple using the documented TimesheetRow > Client relationship. That long route does appear to work, however.

My query is exactly as above, except that the final "load" is now:

     "Load": [        {
          "Relationship": "Task"
        },
        {
          "Relationship": "Client"
        }
      ]

Thanks for any suggestions,

Richard T
Photo of Aashnee Kamboj

Aashnee Kamboj, Community Moderator

  • 1599 Posts
  • 109 Reply Likes
Hi Richard,

Can we request you to share your query with us? This will help us figure out the exact issue.

Thanks,
Aashnee
Photo of Townend, Richard

Townend, Richard

  • 12 Posts
  • 1 Reply Like
Hi Aashnee,

The full query is:

{  "Action": "Query",
  "QueryType": "TimesheetByUserDateRange",
  "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
  "Args": [
    {
      "__type": "Replicon.Domain.User",
      "Identity": "2"
    },
    {
      "__type": "Date",
      "Year": 2016,
      "Month": 5,
      "Day": 8
    },
    {
      "__type": "Date",
      "Year": 2016,
      "Month": 5,
      "Day": 9
    }
  ],
  "Load": [
    {
      "Relationship": "TimeRows",
      "DomainType": "Replicon.Project.Domain.Timesheets.TimesheetTaskRow",
      "Load": [
        {
          "Relationship": "Task"
        },
        {
          "Relationship": "Client"
        }
      ]
    }
  ]
}

If you want me to provide the response and a screenshot of the relevant timesheet, please contact me by email or phone, and I can provide that direct to you.

Thanks,

Richard T
Photo of Aashnee Kamboj

Aashnee Kamboj, Community Moderator

  • 1599 Posts
  • 109 Reply Likes
Hi Richard,

Thank you for providing the details. May we request you to please use the following query and check if you get the desired results:

{
 "Action": "Query",
 "QueryType": "TimesheetByUserDateRange",
 "DomainType": "Replicon.TimeSheet.Domain.Timesheet",
 "Args": [
   {
     "__type": "Replicon.Domain.User",
     "Identity": "2"
   },
   {
     "__type": "Date",
     "Year": 2016,
     "Month": 5,
     "Day": 8
   },
   {
     "__type": "Date",
     "Year": 2016,
     "Month": 5,
     "Day": 9
   }
 ],
 "Load": [
   {
     "Relationship": "TimeRows",
     "DomainType": "Replicon.TimeSheet.Domain.TimesheetTimeRow",
     "Load": [
       {
         "Relationship": "Task"
       },
       {
         "Relationship": "Client"
       }
     ]
   }
 ]
}

Thanks,
Aashnee Kamboj
Photo of Townend, Richard

Townend, Richard

  • 12 Posts
  • 1 Reply Like
Thanks for this. I get very similar results. The only difference (other than the domain statements) is that the new query provides the user-defined-fields for each timesheet row as well as everything else. That is a good thing, and will be useful once I get this figured out and integrated into some usable code!

However, the original problem remains - namely that it is only the 1st row that includes a client, when rows 9-12 (counting from 1, not the 0-based RowPosition) are also all client-based project-tasks (2-8 are non-client project-tasks).

Best Regards,

Richard T
Photo of Aashnee Kamboj

Aashnee Kamboj, Community Moderator

  • 1598 Posts
  • 109 Reply Likes
Thank you for the clarification Richard. Ca we get on a call with you to discuss this further? We have your contact details. All we need is a convenient time to reach you.

Thanks,
Aashnee Kamboj
Photo of Townend, Richard

Townend, Richard

  • 12 Posts
  • 1 Reply Like
Anything between 2 and 3.30PM EST or between 4.45 and 6PM EST today would all work.

If it needs to be tomorrow, let me know and I'll figure some options out.

Thanks,

Richard T