Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Examples > Repositories > Create Repository

Create Repository

Creates a repository in  an account.

icon_curl_v1.png    

Table of Contents

Curl

Prerequisite:  Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.

Example Call

The following example creates a repository in your account and fetches the assets from the repository.  It takes a couple moments for the repository assets to be fetched. You can perform a Show Repository to view the fetch_status and check if the fetch has successfully completed.

Note:

  • When adding a git repository, you need to need to use the repository[credentials][ssh_key] parameter. This value cannot be left blank. If the git repository is public and does not need an SSH Key, set the value to text:. If it is private, paste in text:<your SSH Key>. The source_type needs to be set to git. If you are using credentials, use cred:<SSH credential>.
  • When adding an svn repository, you need to use the repository[credentials][username] and repository[credentials][password] parameters. If these values are blank, use text:. If it is private, specify text:<svn username> and text:<svn password> for the values of the parameters. The source_type needs to be set to svn. You can also use cred:<SVN username credential> and cred:<SVN password credential>.
  • When uploading a compressed file, use the same parameters as you would with an svn repository. The source_type needs to be set to download.
#!/bin/sh -e
curl -i -H X_API_VERSION:1.5 -b mycookie -X POST \
-d repository[name]=MyGitRepository \
-d repository[source]=https://github.com/rightscale/rightscale_cookbooks.git \
-d repository[source_type]=git \
-d repository[credentials][ssh_key]=text: \
https://my.rightscale.com/api/repositories.xml

Sample Output

HTTP/1.1 201 Created
Server: nginx/1.0.14
Date: Wed, 04 Sep 2013 21:21:35 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201 Created
Location: /api/repositories/239933001
X-Runtime: 371
X-Request-Uuid: 03c157ff325b4c28bde370f5a46ce79e
Set-Cookie:
Cache-Control: no-cache
You must to post a comment.
Last modified
12:15, 6 Sep 2013

Tags

This page has no custom tags.

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.