Codebase API Documentation

File Storage

Codebase projects have an area for storing files.

API URLs

Data Method URL
All files in a project GET /project/files
Create a new discussion POST /project/files
Individual file GET /project/files/identifier
Uploading a new version of a file POST /project/files/identifier
File categories in a project GET /project/files/categories

Object Properties

The XML output below shows the properties which are returned by default when accessing file details.

GET /project/discussions/identifier

<project-file>
    <identifier>b47fdc21-d325-12dd-4f17-09455491c414</identifier>
    <category>
        <id type="integer">33</id>
        <name>Screenshots</name>
    </category>
    <name>Screenshot</name>
    <description></description>
    <created-at type="datetime">2013-06-06T13:34:09Z</created-at>
    <updated-at type="datetime">2013-06-06T13:34:09Z</updated-at>
    <file>
        <id type="integer">154</id>
        <identifier>cc57b37a-bab6-d5ec-e7f9-bab323e896b8</identifier>
        <file-name>Screen Shot 2013-06-04 at 10.15.48.png</file-name>
        <content-type>image/png</content-type>
        <file-size type="integer">31707</file-size>
        <url>http://codebase.dev/upload/cc57b37a-bab6-d5ec-e7f9-bab323e896b8/show/original</url>
    </file>
    <previous-revisions type="array">
        <previous-revision>
            <project-file>
                <identifier>fa8ebfb5-bc54-aa8d-7c30-b20c53fb921d</identifier>
                <category>
                    <id type="integer">33</id>
                    <name>Screenshots</name>
                </category>
                <name>Screenshot</name>
                <description></description>
                <created-at type="datetime">2013-06-06T13:33:58Z</created-at>
                <updated-at type="datetime">2013-06-06T13:33:58Z</updated-at>
                <file>
                    <id type="integer">153</id>
                    <identifier>a83868f4-cee1-db6e-7421-9adc84cf85bb</identifier>
                    <file-name>Screen Shot 2013-06-04 at 10.14.55.png</file-name>
                    <content-type>image/png</content-type>
                    <file-size type="integer">33259</file-size>
                    <url>http://codebase.dev/upload/a83868f4-cee1-db6e-7421-9adc84cf85bb/show/original</url>
                </file>
            </project-file>
        </previous-revision>
    </previous-revisions>
</project-file>
  • identifier the identifier for this discussion
  • name the friendly name for this file
  • description the description for this file
  • category the name of the file category
  • previous-revisions previous versions of this file

GET /project/files/categories

<file-category>
  <id type="integer">38</id>
  <name>General</name>
</file-category>

Creating a new file

You can create a new file using the variables listed above, you must require name, category_id and file_upload_token.

file_upload_token should contain an identifier returned from an Attachment Upload