openscholar / integrated_support

2 stars 0 forks source link

Desk API #1

Closed sagotsky closed 11 years ago

sagotsky commented 11 years ago

Find or create a desk API that (bare minimum) handles the following:

  1. OAuth login.
  2. Case: list, search, show, update (requires http_patch)

Nice things to have:

  1. Integration: create, list, update.
  2. Custom field: create, list, update. (Not a part of desk.com API)
  3. Rules: create, list, update. (Not a part of desk.com API)
sagotsky commented 11 years ago

Good news. My custom api lib (tapir) is working now that my desk.com trial has been reactivated.

sagotsky commented 11 years ago

integration api is defined but untested. Working on that next.

sagotsky commented 11 years ago

My desk api implementation is working reliably. It's not complete, but it has URLs for everything I need and is easy to extend.

sagotsky commented 11 years ago

For reference, here's where the API is defined: https://github.com/openscholar/integrated_support/blob/master/lib/tapir/api/desk.json

Here's a snippet:

{
  "name":"Desk.com",
  "apis":{
    "case": {
      "show":{
        "url":"https://{subdomain}.desk.com/api/v2/cases/{id}",
        "method":"get"
      },
      "update":{
        "url":"https://{subdomain}.desk.com/api/v2/cases/{id}",
        "method":"patch",
        "data":["custom_fields"]
      }
    },
    "integration_urls":{
      "list":{
        "url":"https://{subdomain}.desk.com/api/v2/integration_urls",
        "method":"get"
      },
      "show":{
        "url":"https://{subdomain}.desk.com/api/v2/integration_urls/{id}",
        "method":"get"
      },

Case and integration_urls are both APIs. Case has a call for show and update. Integration_urls has list and show. (More are defined in the actual file. An API call is just a url with replaceable strings and an http method. Optionally there's a data attribute which specifies an array of parameters. These parameters are passed to desk as the HTTP_POST body rather than as part of the query string.