Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 10ab06a4e3
Fetching contributors…

Cannot retrieve contributors at this time

201 lines (133 sloc) 5.787 kb
layout
default

Entries

Fetching time entries

The entries resource is used to fetch entries within your account. The interface for selecting entries is the same as the report interface, which we will explain below.

GET /api/entries.xml

Sample requests:

curl -G -H "X-FreckleToken:lx3gi6pxdjtjn57afp8c2bv1me7g89j" https://apitest.letsfreckle.com/api/entries.xml \
  -d 'search[from]=2009-10-10'
curl -G -H "X-FreckleToken:lx3gi6pxdjtjn57afp8c2bv1me7g89j" https://apitest.letsfreckle.com/api/entries.xml \
  -d 'search[tags]=development,design' -d 'search[people]=342,7653,212'

supported options in the search hash:

  • people: comma separated user ids
  • projects: comma separated project ids
  • tags: comma separated tag ids or names (can be mixed, multiple tags will search using AND)
  • from: entries from this date
  • to: entries to this date
  • billable: true only shows billable entries; false only shows unbillable entries

Entries are sorted descending by date.

Roles

All roles can access this resource. Freelancers will only see entries made by themselves in accessible projects.

Creating a time entry

POST /api/entries.xml

Sample request:

curl -d @data/entry.xml -H "Content-type: text/xml" -H "X-FreckleToken:lx3gi6pxdjtjn57afp8c2bv1me7g89j" \
  https://apitest.letsfreckle.com/api/entries.xml

Sample POST body:

<?xml version="1.0" encoding="UTF-8"?>
<entry>
  <minutes>2h</minutes>
  <user>apitest@letsfreckle.com</user>
  <project-id type="integer">8475</project-id>
  <description>freckle restful api test</description>
  <date>2009-10-15</date>
</entry>

Entry attributes

  • minutes (required)

    Amount of time which should be tracked for the entry in a valid format

  • user (required)

    email or login of the user the entry should be associated with

  • project-id

    ID of the project the entry should be associated with

  • description

    Description for the entry, including tags

  • date

    Date formated in YYYY-MM-DD

Response codes

  • 401 Unauthorized

    The user is not authorized to access this information or the authentication token is not valid.

  • 422 Unprocessable Entity

    The request data was not valid.

  • 500 Internal Server Error

    An error occurred. The API call was not processed correctly and should be retried later.

Roles

All roles can access this resource. Freelancers can only create entries in accessible projects. You can fetch the accessible projects through the Projects resource.

Bulk import

You can POST a big bunch of entries to this resource to create a large number of entries at once. This is great when you want to import existing data to your Freckle accunt.

POST /api/entries/import.xml

Sample request:

curl -d @data/entries_import.xml -H "Content-type: text/xml" -H "X-FreckleToken:lx3gi6pxdjtjn57afp8c2bv1me7g89j" \
 https://apitest.letsfreckle.com/api/entries/import.xml

Sample POST body:

<?xml version="1.0" encoding="UTF-8"?>
<entries>
  <entry>
    <minutes>2h</minutes>
    <user>apitest@letsfreckle.com</user>
    <project-name>Fixture Company</project-name>
    <description>freckle restful api test, bulk import</description>
    <date>2009-10-11</date>
  </entry>
  <entry>
    <minutes>30min</minutes>
    <user>apitest@letsfreckle.com</user>
    <description>freckle restful api test, bulk import</description>
    <date>2009-10-12</date>
  </entry>
</entries>

Entry attributes

ATTENTION: the entry format for the import is slightly different to the format used for the create single entry format!

  • minutes (required)

    Amount of time which should be tracked for the entry in a valid format.

  • user (required)

    Email or login of the user the entry should be associated with.

  • project-name

    Name of the project the entry should be associated with. The project will be created if it doesn't exist.

  • description

    Description for the entry, including tags.

  • date

    Date formated in YYYY-MM-DD

Response:

The response will be an array of all created time entries.

<?xml version="1.0" encoding="UTF-8"?>
<entries type="array">
  <entry>
    <billable type="boolean">true</billable>
    <created-at type="datetime">2009-10-16T09:57:22Z</created-at>
    <date type="date">2009-10-11</date>
    <description>freckle restful api test, bulk import</description>
    <id type="integer">83601</id>
    <minutes type="integer">120</minutes>
    <project-id type="integer">8475</project-id>
    <updated-at type="datetime">2009-10-16T09:57:22Z</updated-at>
    <url nil="true"></url>
    <user-id type="integer">5538</user-id>
  </entry>
  <entry>
    <billable type="boolean">true</billable>
    <created-at type="datetime">2009-10-16T09:57:22Z</created-at>
    <date type="date">2009-10-12</date>
    <description>freckle restful api test, bulk import</description>
    <id type="integer">83602</id>
    <minutes type="integer">30</minutes>
    <project-id type="integer" nil="true"></project-id>
    <updated-at type="datetime">2009-10-16T09:57:22Z</updated-at>
    <url nil="true"></url>
    <user-id type="integer">5538</user-id>
  </entry>
</entries>

Response codes

  • 401 Unauthorized

    The user is not authorized to access this information or the authentication token is not valid.

  • 422 Unprocessable Entity

    The request data was not valid.

  • 500 Internal Server Error

    An error occurred. The API call was not processed correctly and should be retried later.

Roles

Everyone can import entries, except for freelancers.

Jump to Line
Something went wrong with that request. Please try again.