It's all about the answers!

Ask a question

RTC-6.0: Read a file from RTC source control using RTC API.


Naveen Tyagi (1874119) | asked Oct 14 '15, 8:24 a.m.
edited Oct 20 '15, 2:56 p.m. by Chris McGee (50511017)
I have a file in Stream-->Component-->Folder-->abc.xml. i want to read the content of that file using API. how can i do this? Also i would be even better if i am able to download this file on my local machine.

3 answers



permanent link
Ralph Schoon (55.1k23642) | answered Oct 14 '15, 8:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 14 '15, 9:00 a.m.


Please be aware, that asking API questions is bare luck if someone has an example
Please consider searching the internet as well, before you ask.

Comments
Ralph Schoon commented Oct 14 '15, 9:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I found it was ANOTHER person that asked the same question that I answered recently.


permanent link
sam detweiler (12.4k6171200) | answered Oct 14 '15, 10:16 a.m.
RTC doesn't store 'files' it stores changes.  and then you get an assembled result of all the changes up to the version you ask for.

these are content objects.

Comments
Geoffrey Clemm commented Oct 14 '15, 2:55 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Note that how the content of a file is stored in the database is an implementation detail that the user and script writer can ignore.   They would retrieve the content of a file, and they do not need to be aware of how that content is assembled form what is stored in the database.  For folks interested in the implementation details, also note that some files are stored in the database in a compressed format, rather than a delta format.


sam detweiler commented Oct 14 '15, 2:57 p.m.

right, don't be concerned with the implementation of storage. use the content objects and methods to get the data.


permanent link
Chris McGee (50511017) | answered Oct 20 '15, 2:56 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi Naveen,

Retrieving the file contents can be done via the CLI as a kind of API with some commands that rarely change between releases.

The CLI is not capable of downloading directly from a stream, but it will load a repository workspace that flows with the stream.

# create a repository workspace using the CLI (if you don't already have one)
lscm create workspace -r <serveruri> -s <yourstreamname> <repositoryworkspacename>

# load repository workspace (in an empty directory)
lscm load -r <serveruri> <repositoryworkspacename>

# accept any new changes from the stream to make sure that we are up-to-date
lscm accept

Now, folder/abc.xml should have the latest contents from the stream.

I hope that this helps,
Chris

Your answer


Register or to post your answer.