Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This article illustrates how to create a profile in the macros using a URL.

Info

Before you begin:

  • Before you enter the URL for a repository, ensure that it complies with the REST standards published by GitHub or GitLab.
  • Click here for more information on REST Pattern for GitLab.
  • Click here for more information on REST Pattern for GitHubis a raw URL. 

    A raw URL is defined as the part of the URL following the domain information and includes the query string, if present. For example, in the URL string http://www.contoso.com/articles/recent.aspx, the raw URL is /articles/recent.aspx

    Tip

    Paste the file link into your browser's address bar. If the actual code is displayed in the browser, it is considered to be invalid or in an incorrect format. If the file downloads to your system, the macros can process the file and its contents.


  • Know what is a complete URL. A typical path for the raw file on GitLab looks like:

    /projects/:id/repository/files/:file_path/raw
  • The host address begins with:
     https://gitlab.com/api/v4
  • The complete URL, in this example, looks like: 
 https://gitlab.com/api/v4/projects/:id/repository/files/:file_path/raw?ref=master
  • For illustrative purposes, we have used a public Bitbucket public repository. The process for adding a profile and using it in macros remains the same for other repositories and external sources.

...

For this example, let's consider using profiles with the HTML macro.

Anchor

...

html_

...

57_HowTo_CompleteURL

...

html_

...

57_HowTo_CompleteURL
Using an absolute URL in a profile

You can create a profile by providing the complete URL for the HTML/XML content.

  1. Navigate to CONFLUENCE ADMINISTRATION > Settings > ATLASSIAN MARKETPLACE > HTML > Profiles.

    Tip
    titleTry this for newer Confluence versions

    Select  > Manage apps, either search for HTML for Confluence or scroll to Bob Swift Configuration, and click HTML to view app configuration.


  2. Click Add Profile.

  3. Enter a unique name for the profile in the Profile name text box. For this example, enter BitURL in the text box.
  4. Select URL Select URL from the options in Profile type
  5. Enter https://bitbucket.org/bob_swift/gint/raw/9c1b737cf0ff28ddf7cbbd199685e533d310ce9f/README.html, for example, in the URL text box. 

  6. Click Save profile to create the profile.

...

  1. Add the HTML macro or edit an existing macro on the page.
  2. Select BitURL from the Profile list and then, click Save.
    <screenshot>

...

  1. Image Added        

Anchor

...

html_

...

57_HowTo_FixedURL

...

html_

...

57_HowTo_FixedURL
Using a partial URL in a profile

You can create a profile by providing a partial URL to access the remote location and entering relative path to the relevant file in the HTML macro.

  1. Navigate to CONFLUENCE ADMINISTRATION > Settings > ATLASSIAN MARKETPLACE > HTML > Profiles.

    Tip
    titleTry this for newer Confluence versions

    Select  > Manage apps, either search for HTML for Confluence or scroll to Bob Swift Configuration, and click HTML to view app configuration.


  2. Click Add Profile.

  3. Enter a unique name for the profile in the Profile name text box. For this example, enter BitURL in the text box.
  4. Select URL from the options in Profile type
  5. Enter https://bitbucket.org in the URL text box.

  6. Click Save profile to create the profile.

...

  1. Add the HTML macro or edit an existing macro on the page.
  2. Select BitURL from the Profile list in the editor.
  3. Enter the relative path to the /bob_swift/gint/raw/9c1b737cf0ff28ddf7cbbd199685e533d310ce9f/README.html file  file, for example, in the Location of HTML data parameter.
  4. Click Save.
    <screenshot>

...

  1. Image Added
Info

This method allows multiple users to access a profile across pages and instances of the macros.

...