Skip to content

Instantly share code, notes, and snippets.

@caseysoftware
Created October 29, 2012 18:02
Show Gist options
  • Select an option

  • Save caseysoftware/3975284 to your computer and use it in GitHub Desktop.

Select an option

Save caseysoftware/3975284 to your computer and use it in GitHub Desktop.
OPTIONS samples
curl -X OPTIONS 'http://localhost/web2project-slim/' -v | python -m json.tool
{
"resource_uri": "/",
"root_uri": "/web2project-slim",
"self": "/web2project-slim/",
"sub_resources": {
"admin": {
"name": "User Admin",
"uri": "/web2project-slim/admin"
},
"calendar": {
"name": "Calendar",
"uri": "/web2project-slim/calendar"
},
"companies": {
"name": "Companies",
"uri": "/web2project-slim/companies"
},
"contacts": {
"name": "Contacts",
"uri": "/web2project-slim/contacts"
},
"departments": {
"name": "Departments",
"uri": "/web2project-slim/departments"
},
"files": {
"name": "Files",
"uri": "/web2project-slim/files"
},
"links": {
"name": "Links",
"uri": "/web2project-slim/links"
},
"projects": {
"name": "Projects",
"uri": "/web2project-slim/projects"
},
"tasks": {
"name": "Tasks",
"uri": "/web2project-slim/tasks"
},
"todos": {
"name": "TodoList",
"uri": "/web2project-slim/todos"
}
}
}
@ralphschindler

Copy link
Copy Markdown

As an example, in the way I was thinking about it it would look like this:

curl -X OPTIONS 'http://localhost/web2project-slim/' -v | python -m json.tool

{
    "resource_uri": "/",
    "root_uri": "/web2project-slim",
    "self": "/web2project-slim/",
    "uris": {
        "GET /admin": {
            "meta_name": "User Admin"
        },
        "GET /calendar": {
            "meta_name": "Calendar"
        },
        "GET /companies": {
            "meta_name": "Companies"
        },
        "GET /contacts": {
            "meta_name": "Contacts"
        },
        /* ... */
        "GET /todos": {
            "meta_name": "TodoList"
        },
    }
}

Similarly:

curl -X OPTIONS https://api.github.com/*

{
    "resource_uri": "/", 
    "root_uri": "https://api.github.com/", 
    "self": "/",
    "uris": {
        /* ":org" could potentially be "<org>" */
        "GET /orgs/:org/issues": {
            "uri_placeholders": {
                "org": "Github Organization Name"
            },
            "parameters_required": [],
            "parameters_optional": ["filter", "state", "labels", "sort", "direction", "since"],
            "meta_documentation_uri": "http://developer.github.com/v3/issues/",
            "meta_name": "List Issues",
            "meta_description": "List all issues for a given organization for the authenticated user",
            "meta_parameters": {
                "filter": {
                    "assigned": "Issues assigned to you (default)",
                    "created": "Issues created by you",
                    "mentioned": "Issues mentioning you",
                    "subscribed": "Issues you’re subscribed to updates for",
                    "all": "All issues the authenticated user can see, regardless of particpation or creation"
                }
            }
        },
        "GET /issues": {
            "meta_name": "List Authenticated Users Issues",
            "meta_description": "List all issues across all the authenticated user’s visible repositories including owned repositories, member repositories, and organization repositories:",
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment