Forum Discussion

nils-drews's avatar
11 years ago

API v2 and curl

I'm trying to familiarize myself with the new V2 API and so far it looks promising - theoretically: I'd like to issue a curl call to play around with the new API as I cannot see the API explorer on the Admin screens.

 

So: How do I find out which API version my Lithium instance supports? 

And: Do you have a curl example to issue a query to the new API?

 

Bye, Nils

9 Replies

  • Anyone who knows how to operate the v2 API just via CURL? And how to find out if I can do this with my community? Do I need to upgrade it somehow or enable the V2 API?

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)
    11 years ago

    nils-drews for the API v2, I think it's best to wait for your platform to be on 14.10

     

    I have used curl for the Rest API v1. I will see if I can use the same for API v2 and update this topic if noone does ...

     

  • nils-drews's avatar
    nils-drews
    Helper
    11 years ago

    That's awesome info ... now can you point me where I see the exact version? Some API call, somewhere on the Admin Screens? Somehow I'm blind.

  • nils-drews's avatar
    nils-drews
    Helper
    11 years ago
    I see in the CSS now this here:
    /****** lia-version 13.8 */
    Does that denote the version I am on?

    Is the Lithium main forum already on the new version with v2 API capabilities? As I see that CSS snippet there as well ....
  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)
    11 years ago

    nils-drews 

     

    I wasn't sure if it was public or not ... You can add /status/version at the end of your community to get the version. Check this for full details.

     

    Now, I believe a curl call should look like this one (couldn't try it unfortunately):

    curl "https://eu.api.lithium.com/community/2.0/search?q=select * from messages&client_id=<your_client_id>&api.pretty_print=true"

    You will need to get your client_id from the Lithium support. (And I think you need to create an 'application'. Works the same way as Google API)

     

    This call, for the Lithium Bulk API (paid feature) worked fine:

    curl "https://eu.api.lithium.com/lsi-data/v1/data/export/community/<community_id>?fromDate=201409010000&toDate=201409020000" -H "client-id:<my_client_id>" -u "<my_token_id>:"

     

    Note: use api.lithium.com if your community is US based

    Note2: I will provide more information as I learn more about the API v2 !

  • nils-drews's avatar
    nils-drews
    Helper
    11 years ago
    Thx a lot! So when I see that my version is 14.8 (14.8-release r231172) then the v2 API is no bueno?

    Also the v2 API operates on a different base URL than the normal community? Is that correct?
  • nils-drews's avatar
    nils-drews
    Helper
    11 years ago

    OlivierS : can you tell me the minimum version of Lithium to be able to use the v2 API? Is 14.8 too old? I'm also still wondering about the other URL ...

  • erjames5's avatar
    erjames5
    Expert
    11 years ago

    The Community API v2 is introduced in version 14.10