API C2C V6

Activités :
Catégories : info site
Type d'article : collaboratif (CC by-sa)

This article provides tips to use the new C2C V6 API.

Source Code

The Git repository is hosted at github

How to get its user ID

You can get your user ID from the URL of your profile. Go to https://www.camptocamp.org and open the user menu and select my profile.

For example https://www.camptocamp.org/profiles/123456/fr corresponds to ID 123456.

Query your profile

Command:

curl https://api.camptocamp.org/profiles/123456 | json_reformat

Response:

{
    "categories": [
        "amateur"
    ],
    "protected": false,
    "areas": [
        {
            "available_langs": null,
            "protected": false,
            "locales": [
                {
                    "title": "Estat francès",
                    "lang": "ca",
                    "version": 2
                },
                {
                    "title": "Frankreich",
                    "lang": "de",
                    "version": 1
                },
                {
                    "title": "France",
                    "lang": "en",
                    "version": 1
                },
                {
                    "title": "Francia",
                    "lang": "es",
                    "version": 1
                },
                {
                    "title": "France",
                    "lang": "eu",
                    "version": 2
                },
                {
                    "title": "France",
                    "lang": "fr",
                    "version": 4
                },
                {
                    "title": "Francia",
                    "lang": "it",
                    "version": 1
                }
            ],
            "area_type": "country",
            "version": 11,
            "type": "a",
            "document_id": 14274
        },
        {
            "available_langs": null,
            "protected": false,
            "locales": [
                {
                    "title": "París",
                    "lang": "ca",
                    "version": 1
                },
                {
                    "title": "Paris",
                    "lang": "de",
                    "version": 1
                },
                {
                    "title": "Paris",
                    "lang": "en",
                    "version": 1
                },
                {
                    "title": "París",
                    "lang": "es",
                    "version": 1
                },
                {
                    "title": "Paris",
                    "lang": "eu",
                    "version": 1
                },
                {
                    "title": "Paris",
                    "lang": "fr",
                    "version": 2
                },
                {
                    "title": "Parigi",
                    "lang": "it",
                    "version": 1
                }
            ],
            "area_type": "admin_limits",
            "version": 8,
            "type": "a",
            "document_id": 14294
        }
    ],
    "associations": {
        "images": [
        ]
    },
    "geometry": {
        "version": 4,
        "geom": "{\"coordinates\": [260419.70356687764, 6250747.925371531], \"type\": \"Point\"}",
        "geom_detail": null
    },
    "type": "u",
    "version": 4,
    "available_langs": [
        "en",
        "fr"
    ],
    "document_id": 365280,
    "quality": "draft",
    "forum_username": "John_Doe",
    "activities": [
        "skitouring",
        "snow_ice_mixed",
        "mountain_climbing",
        "rock_climbing",
        "hiking"
    ],
    "locales": [
        {
            "lang": "en",
            "version": 5,
            "description": "...",
            "summary": null,
            "topic_id": null
        },
        {
            "lang": "fr",
            "version": 6,
            "description": "...",
            "summary": null,
            "topic_id": null
        }
    ],
    "name": "John Doe"
}

Query outings

https://api.camptocamp.org/outings

Possible filters

There are flags that allow the user to filter results.

Construction of the request

The URL should look like https://api.camptocamp.org/outings?flag1=criteria1&flag2=criteria2&…

Flags

u=USERID Get outings associated with this (or these) user(s)
limit=INT Limits the number of results to the desired integer
l=LANG Get only the selected language

Commentaires

Avatar
Fabrice_Salvaire 8 years ago

Pour l’instant le markup bogue …

Avatar

Je confirme. Les URL entrées dans des blocs de code sont parsées et transformées en liens, mais avec affichage des balises <a></a>