Forum Discussion

kjackman's avatar
kjackman
Helper
13 years ago

where is the documentation for endpoints

I need to use the "Endpoints" feature in Lithium Studio to retrieve data in a single call that would require many calls in the REST API.  I can get to Endpoints in Lithium Studio just fine, but I can't seem to find any documentation on the feature.  Can someone point me in the right direction?

 

Searching the Lithium knowledge base yields zero results on the word “endpoints.”  When I search the developer forums, I see that people have questions about it, but I can’t seem to find anything that tells me how the Endpoints feature is used, how I would call one, or anything else. 

 

Thanks!

  • Hi kjackman,

     

    You can kind of think of an endpoint as a stand-alone custom component. If you're not familiar with creating custom components in Lithium, I'd start there. If you're already experienced with custom components, then you're off to a great start!

     

    Here are some good resources for getting started with custom components in case you'd like to learn more about that or brush up on it:

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/203-Lithium-Studio-Overview/ta-p/5935

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/213-Studio-Advanced/ta-p/20470

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/Writing-custom-components-in-Lithium-Studio/ta-p/9217

    http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/Admin-Guide-REST-API-JavaDocs/ta-p/5966

     

    There are also lots and lots of code samples for custom components in the community:

    http://lithosphere.lithium.com/t5/tag/code%20sample/tg-p

     

    As you may know, custom components are typically added to a page within the community. When rendered, they appear as part of that page, blending into the look and feel of the page. The difference with an endpoint, is that it stands on its own.

     

    Each endpoint has a URL that you can use to access it directly, and you can also set the response format of the endpoint (ie. html, xml, json, etc).There is no wrapper, formatting, or styling inherent to endpoints like there is for custom components. So for endpoints, the output of the component is the output of the endpoint. You have complete control over what's rendered at that URL.

     

    This may seem pretty simple at first, but endpoints can be very powerful. Some examples of ways in which I've personally used endpoints include:

    • Modifying community or user attributes
    • Passing in a user's ID to get back HTML via Ajax for displaying a tooltip when hovering over usernames
    • Injecting additional data into a REST API response to supplement the existing data

    To create a new endpoint:

    1. Browse to the "Endpoints" tab in Studio
    2. Click "New Endpoint"
    3. Give it a title (ie. "test_endpoint"). This title will be used as part of the URL for accessing the endpoint.
    4. Click "Save"
    5. On the next page, enter some content for "View Content", ie. "Welcome to ${community.title}! Hello ${user.login!"anonymous user"}!" This is what you want to render at the endpoint.
    6. Select a "View Content Type", ie. "text/html". This will be the response type for the endpoint.
    7. The path should be pre-populated. You can leave it as is unless you really want to rename the path for the endpoint.
    8. Click "Save"
    9. After you save, click the link at the bottom of the page to view your endpoint. This is the URL you can use to access your endpoint.

    That's it; you've just created your first endpoint! 

     

    I hope this helps! If you have additional questions, just let us know.

     

    -Adam

3 Replies

  • AdamN's avatar
    AdamN
    Khoros Oracle
    13 years ago

    Hi kjackman,

     

    You can kind of think of an endpoint as a stand-alone custom component. If you're not familiar with creating custom components in Lithium, I'd start there. If you're already experienced with custom components, then you're off to a great start!

     

    Here are some good resources for getting started with custom components in case you'd like to learn more about that or brush up on it:

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/203-Lithium-Studio-Overview/ta-p/5935

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/213-Studio-Advanced/ta-p/20470

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/Writing-custom-components-in-Lithium-Studio/ta-p/9217

    http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api

    http://lithosphere.lithium.com/t5/Developers-Knowledge-Base/Admin-Guide-REST-API-JavaDocs/ta-p/5966

     

    There are also lots and lots of code samples for custom components in the community:

    http://lithosphere.lithium.com/t5/tag/code%20sample/tg-p

     

    As you may know, custom components are typically added to a page within the community. When rendered, they appear as part of that page, blending into the look and feel of the page. The difference with an endpoint, is that it stands on its own.

     

    Each endpoint has a URL that you can use to access it directly, and you can also set the response format of the endpoint (ie. html, xml, json, etc).There is no wrapper, formatting, or styling inherent to endpoints like there is for custom components. So for endpoints, the output of the component is the output of the endpoint. You have complete control over what's rendered at that URL.

     

    This may seem pretty simple at first, but endpoints can be very powerful. Some examples of ways in which I've personally used endpoints include:

    • Modifying community or user attributes
    • Passing in a user's ID to get back HTML via Ajax for displaying a tooltip when hovering over usernames
    • Injecting additional data into a REST API response to supplement the existing data

    To create a new endpoint:

    1. Browse to the "Endpoints" tab in Studio
    2. Click "New Endpoint"
    3. Give it a title (ie. "test_endpoint"). This title will be used as part of the URL for accessing the endpoint.
    4. Click "Save"
    5. On the next page, enter some content for "View Content", ie. "Welcome to ${community.title}! Hello ${user.login!"anonymous user"}!" This is what you want to render at the endpoint.
    6. Select a "View Content Type", ie. "text/html". This will be the response type for the endpoint.
    7. The path should be pre-populated. You can leave it as is unless you really want to rename the path for the endpoint.
    8. Click "Save"
    9. After you save, click the link at the bottom of the page to view your endpoint. This is the URL you can use to access your endpoint.

    That's it; you've just created your first endpoint! 

     

    I hope this helps! If you have additional questions, just let us know.

     

    -Adam

  • Would there be a way to use endpoints to update all fields in a user's profile with one call?