Monday 29 September 2014

Rest_TimeEntries



Time Entries
Listing time entries
GET /time_entries.xml
Returns time entries.
Showing a time entry
GET /time_entries/[id].xml
Returns the time entry of given id.
Creating a time entry
POST /time_entries.xml
Creates a time entry.
Parameters:
  • time_entry (required): a hash of the time entry attributes, including:
    • issue_id or project_id (only one is required): the issue id or project id to log time on
    • spent_on: the date the time was spent (default to the current date)
    • hours (required): the number of spent hours
    • activity_id: the id of the time activity. This parameter is required unless a default activity is defined in Redmine.
    • comments: short description for the entry (255 characters max)
Response:
  • 201 Created: time entry was created
  • 422 Unprocessable Entity: time entry was not created due to validation failures (response body contains the error messages)
Updating a time entry
PUT /time_entries/[id].xml
Updates the time entry of given id.
Parameters:
  • time_entry (required): a hash of the time entry attributes (same as above)
Response:
  • 200 OK: time entry was updated
  • 422 Unprocessable Entity: time entry was not updated due to validation failures (response body contains the error messages)
Deleting a time entry
DELETE /time_entries/[id].xml
Deletes the time entry of given id.
Insert TimeEntry Code

public string InsertTimeEntries(string host, string key)
 {

  ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, error) => true;

var manager = new RedmineManager(host, key);

 TimeEntry timeent = new TimeEntry();

 timeent.Issue = new IdentifiableName { Id = 3175, Name = "Sample Test Issue" };

 timeent.Project = new IdentifiableName() { Id = 88, Name = "Jacobson - SSRS" };

 timeent.SpentOn = DateTime.Now;

 timeent.Hours = 3;

 timeent.Comments = "Testing of the Code";

 timeent.User = new IdentifiableName { Id = 111, Name = "narendra.kushwaha" };

 timeent.Activity = new IdentifiableName { Id = 14, Name = "Coding" };

 manager.CreateObject(timeent);
  }

No comments:

Post a Comment

C# LINQ Joins With SQL

There are  Different Types of SQL Joins  which are used to query data from more than one database tables. In this article, you will learn a...