NAV Navbar
Home icon
SAS Viya REST APIs
shell javascript python
  • Text Analytics
  • Text Analytics

    Sentiment Analysis

    Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

    The Sentiment Analysis API is used to perform sentiment analysis on natural language text documents according to a prebuilt or user-defined model.

    Base URLs:

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/ \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.api+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.api+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.api+json'
    }
    
    r = requests.get('https://www.example.com/sentiment/', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /

    Returns a list of top-level resource links in this API.

    Example responses

    200

    {
      "version": 1,
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    
    Status Meaning Description Schema
    200 OK Returns a list of links to the top-level resources in this API. Inline

    Retrieve the header information for the API resource

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/sentiment/
    
    
    
    $.ajax({
      url: 'https://www.example.com/sentiment/',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/sentiment/', params={
    
    )
    
    print r.json()
    
    

    HEAD /

    Retrieves header information for the API resource. Can also be used to check if the service is available.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. API resource links are available. None

    Get a collection of jobs

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/jobs \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/sentiment/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs

    Returns a list of sentiment analysis jobs that were created by the user.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering the domains. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting the collection. See Sorting in REST APIs.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "description": "string",
          "language": "ar",
          "modelUri": "string",
          "outputTableNamePostfix": "string",
          "inputUri": "string",
          "documentIdVariable": "string",
          "textVariable": "string",
          "version": 0,
          "id": "string",
          "state": "pending",
          "creationTimeStamp": "string",
          "links": [
            {
              "method": "string",
              "rel": "string",
              "uri": "string",
              "href": "string",
              "title": "string",
              "type": "string",
              "itemType": "string",
              "responseType": "string",
              "responseItemType": "string"
            }
          ]
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current jobs are returned for the given user. jobCollection

    Retrieve header information for the collection of jobs

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/sentiment/jobs
    
    
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/sentiment/jobs', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs

    Retrieves header information for the collection of jobs. Can also be used to check if the collection exists.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering the collection. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting the collection. See Sorting in REST APIs.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The collection is available. None

    Create a job to analyze a table of documents

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/sentiment/jobs \
      -H 'Content-Type: application/vnd.sas.text.sentiment.job.request+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.sentiment.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.sentiment.job.request+json',
      'Accept':'application/vnd.sas.text.sentiment.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.sentiment.job.request+json',
      'Accept': 'application/vnd.sas.text.sentiment.job+json'
    }
    
    r = requests.post('https://www.example.com/sentiment/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs

    Even though this call returns immediately, the job might not be complete because the sentiment analysis task is running asynchronously. Other resources are provided to access more information about this job. The state link can be used to check the state of a job. When the state of the job is completed, it is done. The results link is available to fetch its results only when the state of the job is completed. If the state becomes 'error', the error link is available to get more information describing what went wrong. At any time, the log link can be used to fetch the plain text log of this job.

    Body parameter

    {
      "description": "string",
      "language": "ar",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string"
    }
    

    Parameters

    Parameter In Type Required Description
    body body jobRequest false Indicates the analysis to create.

    Example responses

    202

    {
      "description": "string",
      "language": "ar",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted The request has been accepted for processing, but the processing has not been completed. job
    400 Bad Request The request was invalid. The specified job request payload was not valid. The response contains details about why the payload is not valid. None
    404 Not Found No project or table exists at the requested path. None
    409 Conflict The request could not be completed due to a conflict with the current state of the resource. A job with the specified ID already exists. None

    Create a job to analyze documents in the request

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/sentiment/jobs#data \
      -H 'Content-Type: application/vnd.sas.text.sentiment.job.request.documents+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.sentiment.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.sentiment.job.request.documents+json',
      'Accept':'application/vnd.sas.text.sentiment.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs#data',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.sentiment.job.request.documents+json',
      'Accept': 'application/vnd.sas.text.sentiment.job+json'
    }
    
    r = requests.post('https://www.example.com/sentiment/jobs#data', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs#data

    Even though this call returns immediately, the job might not be complete because the sentiment analysis task is running asynchronously. Other resources can be used to check the state of an analysis and to fetch its results when complete.

    Body parameter

    {
      "description": "string",
      "language": "ar",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "caslibUri": "string",
      "documents": [
        "string"
      ]
    }
    

    Parameters

    Parameter In Type Required Description
    body body jobRequestFromDocuments false Indicates the job to be created.

    Example responses

    202

    {
      "description": "string",
      "language": "ar",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted The request has been accepted for processing, but the processing has not been completed. The job was created and will run in the background. job
    400 Bad Request The request was invalid. The specified job request payload was not valid. The response contains details about why the payload is not valid. error2
    404 Not Found No project or table exists at the requested path. error2
    409 Conflict A job with the specified ID already exists. error2

    Get a specific job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.sentiment.job+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.text.sentiment.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.text.sentiment.job+json'
    }
    
    r = requests.get('https://www.example.com/sentiment/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}

    Returns information about a specific bulk analysis.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Example responses

    200

    {
      "description": "string",
      "language": "ar",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Information about the job is returned. job
    404 Not Found The specified job ID was not found. error2

    Retrieve header information for a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/sentiment/jobs/{jobId}
    
    
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/sentiment/jobs/{jobId}', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}

    Retrieves header information for a job. Can also be used to check if the job exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The job header information is available. None
    404 Not Found The specified job ID was not found. None

    Delete the specified bulk analysis job from the server

    Code samples

    # You can also use wget
    curl -X DELETE https://www.example.com/sentiment/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: */*'
    
    
    var headers = {
      'Accept':'*/*'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}',
      method: 'delete',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': '*/*'
    }
    
    r = requests.delete('https://www.example.com/sentiment/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    DELETE /jobs/{jobId}

    Enables a client to delete a bulk analysis. Jobs that have completed are not deleted automatically. A client needs to delete them when they no longer need access to the results. If a job is still running when it is deleted, it is canceled before the delete is processed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    404

    Responses

    Status Meaning Description Schema
    204 No Content The job was successfully deleted. None
    404 Not Found The specified job ID was not found. error2

    Get the state of an existing job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/jobs/{jobId}/state \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/state',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/sentiment/jobs/{jobId}/state', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/state

    Enables a client to check the state of a bulk analysis. This can be used to poll a running job in order to know when it is complete. Valid values are: pending, running, completed, canceled, and failed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current job state is available. taskState
    404 Not Found The specified job ID was not found. error2

    Retrieve header information for the state of an existing job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/sentiment/jobs/{jobId}/state
    
    
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/state',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/sentiment/jobs/{jobId}/state', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/state

    Retrieve header information for the state of an existing job. Can also be used to check if the job state exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current job state is available. None
    404 Not Found The specified job ID was not found. None

    Cancel a running job

    Code samples

    # You can also use wget
    curl -X PUT https://www.example.com/sentiment/jobs/{jobId}/state?value=canceled \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/state',
      method: 'put',
      data: '?value=canceled',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.put('https://www.example.com/sentiment/jobs/{jobId}/state', params={
      'value': 'canceled'
    }, headers = headers)
    
    print r.json()
    
    

    PUT /jobs/{jobId}/state

    Enables a caller to cancel a running bulk analysis. This operation is available via the cancel link on the job only if the job can be canceled. A job is available to be canceled if it has not yet finished processing.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    value query string true Used to cancel a running job.

    Enumerated Values

    Parameter Value
    value canceled

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The state was successfully updated. The response contains the updated state. taskState
    400 Bad Request The request was invalid. The specified state value is not a valid state. error2
    404 Not Found The specified job ID was not found. error2
    409 Conflict The request could not be completed. The job is not running. It could have already
    completed, canceled, or resulted in an error. error2

    Get the result of a specified job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/jobs/{jobId}/results \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/results',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/sentiment/jobs/{jobId}/results', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/results

    Allows a client to retrieve the results for a completed bulk analysis. This operation is available only when the job has a state value of completed. Instead of invoking this endpoint directly, users are recommended to wait for the results link to be available on the job. This link appears only when the results are available.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    start query integer false Indicates the start index for pagination.
    limit query integer false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "id": "string",
          "sentiment": "positive",
          "probability": 0,
          "version": 0
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The result of the job is available. jobResult
    404 Not Found The specified job ID was not found. It is also possible that

    the job is still running and the results are not yet available or the job was canceled.|error2|

    Retrieve header information for the result of a specific job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/sentiment/jobs/{jobId}/results
    
    
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/results',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/sentiment/jobs/{jobId}/results', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/results

    Retrieves header information for the result of a specific job. Can also be used to check if the job results exist.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    start query integer false Indicates the start index for pagination.
    limit query integer false Indicates the limit parameter for pagination.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The result of the job is available. None
    404 Not Found The specified job ID was not found. None

    Get the log for a job as plain text

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/jobs/{jobId}/log \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/log',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/sentiment/jobs/{jobId}/log', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log

    Enables a client to view the log for a bulk analysis. The log might be helpful in diagnosing problems with the job. This resource can be called regardless of whether the job is running.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log for the job is available. string
    404 Not Found The specified job ID was not found. error2

    Retrieve header information for the job log

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/sentiment/jobs/{jobId}/log
    
    
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/log',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/sentiment/jobs/{jobId}/log', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/log

    Retrieves header information for the log for this job. Can also be used to check if the log exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log is available. None
    404 Not Found The specified job ID was not found. None

    Get the log for a job as a collection of log lines

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/jobs/{jobId}/log#collection \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/log#collection',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/sentiment/jobs/{jobId}/log#collection', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log#collection

    Returns the log from this job formatted as a collection of application/vnd.sas.compute.log.line objects.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    start query integer false Indicates the start index for pagination.
    limit query integer false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "version": 1,
          "type": "normal",
          "line": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK This job's log. logLineCollection
    404 Not Found The specified job ID was not found. error2

    Get errors for a failed job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/sentiment/jobs/{jobId}/errors \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.error+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.error+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/errors',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.error+json'
    }
    
    r = requests.get('https://www.example.com/sentiment/jobs/{jobId}/errors', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/errors

    Returns any errors that were raised as a result of a job. Note that the response might contain multiple errors via the nested errors array member. This endpoint is available only when the job state is failed. It is best accessed through the errors link from the job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Example responses

    200

    {
      "message": "string",
      "id": "string",
      "errorCode": 0,
      "httpStatusCode": 0,
      "details": [
        "string"
      ],
      "remediation": "string",
      "errors": [
        null
      ],
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The errors for the job are available. error2
    204 No Content The ID was found and there are no errors for this job. None
    404 Not Found The specified job ID was not found. error2

    Retrieve header information for the job errors

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/sentiment/jobs/{jobId}/errors
    
    
    
    $.ajax({
      url: 'https://www.example.com/sentiment/jobs/{jobId}/errors',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/sentiment/jobs/{jobId}/errors', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/errors

    Retrieves header information for the job errors. Can also be used to check if errors exist for the job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Errors are available. None
    404 Not Found The specified job ID was not found. None

    Schemas

    baseJobRequest

    Properties

    Common Job Request Properties

    Name Type Required Description
    description string false Indicates an optional string that can be used to describe in a human-readable format what this job represents. Its purpose is purely informative and it is not used for the analysis.
    language string true Indicates a two-letter ISO 639-1 language that should be used to select the domain-independent sentiment model.
    modelUri string false Indicates the URI to a CAS table that contains one or more sentiment model binaries. If left blank, the default model for the specified language is used.
    outputTableNamePostfix string false Indicates text to add to the end of the output table names. If left blank, the server generates text.
    Enumerated Values
    Property Value
    language ar
    language de
    language en
    language es
    language fa
    language fr
    language it
    language ja
    language ko
    language nl
    language pt
    language tr
    language zh
    language zh_cn
    language zh_tw

    jobRequest

    Properties

    Job Request for a Table

    Name Type Required Description
    Job Request for a Table any false Indicates a bulk sentiment analysis request on a collection of documents. This is the application/vnd.sas.text.sentiment.job.request media type.

    allOf

    Name Type Required Description
    anonymous baseJobRequest false Indicates the common properties that can be specified for a job request.

    and

    Name Type Required Description
    anonymous object false
    » inputUri string true Indicates the URI containing the reference to the table containing the input documents.
    » documentIdVariable string true Indicates the name of the column in the input table that contains the unique document ID.
    » textVariable string true Indicates the name of the column in the input table that contains the actual document text.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    jobRequestFromDocuments

    Properties

    Job Request for Documents in the Request

    Name Type Required Description
    Job Request for Documents in the Request any false Indicates a request to create a sentiment analysis job from inline documents. This is the application/vnd.sas.text.sentiment.job.request.documents media type.

    allOf

    Name Type Required Description
    anonymous baseJobRequest false Indicates the common properties that can be specified for a job request.

    and

    Name Type Required Description
    anonymous object false
    » caslibUri string true Indicates the URI pointing to a caslib in which data will be stored.
    » documents [string] true Indicates the text documents to categorize. These documents are identified in the order in which they are specified to the API, starting from 1 and proceeding sequentially.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    taskState

    Properties

    Job State

    Name Type Required Description
    Job State string false Indicates the state of the job.
    Enumerated Values
    Property Value
    Job State pending
    Job State running
    Job State completed
    Job State canceled
    Job State failed

    job

    Properties

    Sentiment Analysis Job

    Name Type Required Description
    Sentiment Analysis Job any false Indicates a sentiment analysis job. This is the application/vnd.sas.text.sentiment.job media type.

    allOf

    Name Type Required Description
    anonymous jobRequest false Indicates a bulk sentiment analysis request on a collection of documents. This is the application/vnd.sas.text.sentiment.job.request media type.

    and

    Name Type Required Description
    anonymous object false
    » id string true Indicates the ID that uniquely defines the analysis job.
    » state taskState true Indicates the current running state of the analysis. The potential values are pending, running, completed, canceled, and failed.
    » creationTimeStamp string true Indicates a string containing the datetime value when an analysis was originally created in format yyyy-mm-ddThh:mm:ssZ.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.
    » links [any] true Indicates an array containing zero or more link objects. See the API link relations table for a description of the API links.
    »» Link object false A link to a related operation or resource.
    »»» method string false The HTTP method for the link.
    »»» rel string true The relationship of the link to the resource.
    »»» uri string false The relative URI for the link.
    »»» href string false The URL for the link.
    »»» title string false The title for the link.
    »»» type string false The media type or link type for the link.
    »»» itemType string false If this is a link to a container, itemType is the media type or link type for the items in the container.
    »»» responseType string false The media type or link type of the response body for a PUT, POST, or PATCH operation.
    »»» responseItemType string false The media type or link type of the items in the response body for a PUT, POST, or PATCH operation.

    jobCollection

    Properties

    Collection of Jobs

    Name Type Required Description
    Collection of Jobs any false

    allOf

    Name Type Required Description
    anonymous object false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)
    » name string false The name of the collection.
    » start integer(int64) false The zero-based index of the first item in the collection.
    » limit integer false The number of items that were requested for the collection.
    » count integer(int64) false The number of items in the collection.
    » accept string false A space-delimited list of media types from which an Accept header may be constructed.
    » links [links] false The links that apply to the collection.
    » version integer false The version number of the collection representation. This representation is version 2.

    and

    Name Type Required Description
    anonymous object false
    » items [job] true Indicates an array containing sentiment analysis objects.

    analysis

    Properties

    Sentiment Analysis

    Name Type Required Description
    id string true Indicates the identifier that links the input document to its analysis. If a table was supplied, this value corresponds to the documentIdVariable value. If documents were supplied directly to the service, this value corresponds to the order that the documents were supplied. The first document receives an 'id' value of 1, the second 2, and so on.
    sentiment string true Indicates the sentiment value determined for this document.
    probability number(double) true Indicates a confidence metric measuring the probability that the selected sentiment correctly matches the document.
    version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.
    Enumerated Values
    Property Value
    sentiment positive
    sentiment negative
    sentiment neutral

    jobResult

    Properties

    Sentiment Analysis Result

    Name Type Required Description
    Sentiment Analysis Result any false

    allOf

    Name Type Required Description
    anonymous jobCollection false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [analysis] false Indicates the collection of results where each entry corresponds to the result for one input document. Results are linked to input documents by the 'id' field.

    logLineCollection

    Properties

    Collection of Log Lines

    Name Type Required Description
    Collection of Log Lines any false Indicates the collection of lines from the log file.

    allOf

    Name Type Required Description
    anonymous jobCollection false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [any] true
    »» Log Line object false A single line in a log. This is the application/vnd.sas.compute.log.line media type.
    »»» version integer(int32) true The version number of the Log Line (logLine) representation. This is version 1.
    »»» type string true The line entry classification.
    »»» line string true The line of text without the type (classification) prefix marker.
    Enumerated Values
    Property Value
    type normal
    type highlighted
    type source
    type title
    type byline
    type footnote
    type error
    type warning
    type note
    type message

    error2

    Properties

    Error

    Name Type Required Description
    message string false The message for the error.
    id string false The string ID for the error.
    errorCode integer false The numeric ID for the error.
    httpStatusCode integer true The HTTP status code for the error.
    details [string] false Messages that provide additional details about the cause of the error.
    remediation string false A message that describes how to resolve the error.
    errors [error2] false Any additional errors that occurred.
    links [links] false The links that apply to the error.
    version integer true The version number of the error representation. This representation is version 2.

    Usage Notes

    Overview

    The Sentiment Analysis API allows a client to assign a sentiment score to a document or a collection of documents. Knowing the sentiment of a document allows a client to better understand the overall tone of a document. Currently, this service supports document-level sentiment. For each document, the service returns a sentiment score and a probability for the sentiment score. A sentiment score is a string that contains one of three values: positive, negative, or neutral. The probability score is a number between 0.0 and 1.0 that indicates how positive or negative the score is.

    This API provides two different interactions for scoring: scoring CAS tables containing documents and scoring documents that are uploaded directly into the API. In both cases, the service uses an asynchronous execution model. The client creates an analysis job that runs in the background after the Create operation returns. The API provides resource endpoints for checking the state of the job. Then, when complete, the results are retrieved using either the /results endpoint on the job, or by interacting with the result table directly by using another SAS service such as the Row Sets API.

    One of the values the API takes as input is a language parameter. For English, the language parameter must take the form of en (ISO-639-1 short code for English). The language parameter is used to select the sentiment binary model that scores the documents. The language binaries are considered to be domain-independent because they are designed to work across different domains.

    When scoring a table as input, the API views each row in the input table as a document. Thus, the API requires two input parameters: documentIdVariable and textVariable. The documentIdVariable is a unique identifier for the document and the textVariable is the actual document text. For example, consider a table containing tweets from @SASSoftware:

    ID Date Created Message
    850007368138018817 Thu Apr 06 15:28:43 +0000 2017 Real-time and #AI are changing marketing: join 9/13 #SASWebinar with special guest from @Forrester
    787452347508998458 Thu Apr 06 12:54:02 +0000 2017 US has over 4 million miles of roads that could have 10 million fully or semi autonomous cars by 2020 #IoT
    774598598680208850 Thu Apr 06 12:28:22 +0000 2017 Need help with your fight against #fraud?

    In this example, the documentIdVariable is ID and the textVariable is Message.

    The API supports all models provided by SAS as well as user-defined models. The modelUri input parameter takes a URI to a CAS table containing one or more sentiment models.

    Terminology

    job

    a container for an asynchronous operation. A job supports a number of different operations such as checking state, canceling an operation, fetching results and so on. All sentiment scoring operations are performed asynchronously.

    language

    a parameter that specifies which domain-independent sentiment model should be used for processing the input documents. This parameter is required when processing tables or uploaded documents. For English, the language parameter must take the form of "en" (see ISO-639-1 short codes).

    library

    a container for inputs and outputs when you use CAS. Services such as Sentiment use a library to locate input data and store output tables that they create.

    model

    a parameter that is used to determine sentiment scores. A model is represented in binary format in a CAS table. Currently, the domain-independent sentiment models (based on language) are provided by SAS and developed by SAS linguists.

    probability

    a value between 0.0 and 1.0 that is directly related to the sentiment score assigned to the document. The sentiment service has a probability threshold default value of 0.5. If the probability is above the threshold, the document is positive. If the probability matches the threshold, the document is neutral. If the probability is below the threshold, the document is negative.

    sentiment score

    a score given to a document. This parameter contains a string with one of three values: positive, negative, or neutral.

    table

    the input for and the output from bulk processing. An input table must have both an ID column and a column that contains the text data. Additional columns can be included in an input table. Output tables are generated by the service. An output table contains three columns: id, sentiment, and probability.

    Resources

    Resource Relationships

    This diagram shows the relationships between the resources in this API.

    Sentiment entity relationship diagram

    Root

    Path: /

    The root of the API. This resource contains links to the top-level resources in the API. The response uses the application/vnd.sas.api media type.

    The GET / response includes the following links.

    Relation Method Description
    jobs GET Returns the first page of the collection of jobs.
    URI: /jobs
    Response type: application/vnd.sas.collection
    Response item type: application/vnd.sas.text.sentiment.job
    startAnalysis POST Submits a new analysis job for execution.
    URI: /jobs
    Request type: application/vnd.sas.text.sentiment.job.request or application/vnd.sas.text.sentiment.job.request.documents.
    Response type: application/vnd.sas.text.sentiment.job

    Jobs

    Path: /jobs

    This API provides collections of jobs. Members of the /jobs collection are job resources, /job/{jobId}. (See below.)

    The GET operation on this path returns a application/vnd.sas.collection. Collection responses include the following links.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page of the collection.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    Sorting and Filtering

    This collection can be sorted and filtered using the ?sortBy= and ?filter= query parameters.

    Filtering and sorting use the following members of the Job resource:

    Job

    Path: /jobs/{jobId}

    A specific job resource. A job resource has the following link relations in the appication/vnd.sas.text.sentiment.job representation.

    Relation Method Description
    self GET Returns the job itself.
    URI: /jobs/{jobId}
    Response type: application/vnd.sas.text.sentiment.job
    delete DELETE Deletes the job.
    URI: /jobs/{jobId}
    state GET Returns the job state.
    URI: /jobs/{jobId}/state
    Response type: text/plain
    cancel PUT Cancels the job.1
    URI: /jobs/{jobId}/state?value=canceled
    results GET Returns the job results.2
    URI: /jobs/{jobId}/results
    Response type: application/vnd.sas.text.sentiment.job.results
    errors GET Returns any errors associated with the job.3
    URI: /jobs/{jobId}/errors
    Response type: application/vnd.sas.error
    log GET Returns the log associated with the job.
    URI: /jobs/{jobId}/log
    Response type: text/plain or application/json
    caslib GET Returns the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib

    1 - Only available when the state of this job is 'pending' or 'running'.
    2 - Only available when the state of this job is 'completed'.
    3 - Only available when the state of this job is 'failed' or 'canceled'.

    Job Results

    Path: /jobs/{jobId}/results

    The results from a specific sentiment analysis job. This path returns links to the resources that are available as results from this job.

    The GET operation on this path returns a application/vnd.sas.api representation. Responses include the following links.

    Relation Method Description
    self GET Returns links to the current results.
    up GET Returns the parent resource.
    caslib GET Returns the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib
    documentSentimentTable GET Returns the backing table for the results
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table

    Media Types

    application/vnd.sas.text.sentiment.job.request+json

    The vnd.sas.text.sentiment.job.request media type represents a request to start a sentiment analysis job that processes a table as input.

    This is described by jobRequest.

    { "description": "My table request", "language": "en", "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/example", "outputTableNamePostfix": "-TMP", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/input", "documentIdVariable": "id", "textVariable": "text" }

    application/vnd.sas.text.sentiment.job.request.documents+json

    The vnd.sas.text.sentiment.job.request.documents media type represents a request to start a sentiment analysis job that processes the documents provided in the request payload.

    This is described by jobRequestFromDocuments.

    { "description": "My inline document request", "language": "en", "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/example", "outputTableNamePostfix": "-TMP", "caslibUri": "/casManagement/servers/cas/caslibs/lib", "documents": ["This text to analyze.", "This additional document to analyze"] }

    application/vnd.sas.text.sentiment.job+json

    The vnd.sas.text.sentiment.job media type represents a job created to perform sentiment analysis. That job could have been started to process a table using the application/vnd.sas.text.sentiment.job.request media type, or it could be processing documents that were uploaded directly using the application/vnd.sas.text.sentiment.job.request.documents media type.

    This is described by job.

    { "version": 1, "id": "37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7", "state": "completed", "language": "en", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/input", "documentIdVariable": "id", "textVariable": "reviewbody", "creationTimeStamp": "2017-09-08T20:15:13.273Z", "links": [ { "method": "GET", "rel": "self", "href": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7", "uri": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7", "type": "application/vnd.sas.text.sentiment.job" }, { "method": "DELETE", "rel": "delete", "href": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7", "uri": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7" }, { "method": "GET", "rel": "state", "href": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7/state", "uri": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7/state", "type": "text/plain" }, { "method": "GET", "rel": "log", "href": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7/log", "uri": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7/log", "type": "text/plain" }, { "method": "GET", "rel": "results", "href": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7/results", "uri": "/sentiment/jobs/37b0db7b-c02e-4fb6-9e7c-c1261f97fdf7/results", "type": "application/vnd.sas.collection" }, { "method": "GET", "rel": "caslib", "href": "/casManagement/servers/cas/caslibs/lib", "uri": "/casManagement/servers/cas/caslibs/lib", "type": "application/vnd.sas.cas.caslib" } ] }

    application/vnd.sas.text.sentiment.concept.result+json

    The vnd.sas.text.sentiment.job.result media type represents the sentiment score for a document regardless of whether the document came from a table or was uploaded directly into the job.

    This is described by analysis.

    { "version": 1, "id": "r1", "sentiment": "positive", "probability": 0.692307710647583 }

    application/vnd.sas.api

    Contains top-level links for an API. See application/vnd.sas.api.

    application/vnd.sas.collection

    A paginated, filterable, sortable collection of resource representations. See application/vnd.sas.collection.

    application/vnd.sas.error

    A detailed description of an error. See application/vnd.sas.error.

    application/vnd.sas.compute.log.line

    A single line from a log file. For this service, the log is from the execution of a job. See application/vnd.sas.compute.log.line.

    Error Codes

    HTTP Status Code Error Code Description
    400 71205 The request was invalid. The specified state value is not a valid state.
    400 71206 The request was invalid. The specified state value is not a valid state. Only the state 'canceled' is permitted.
    400 71212 The specified paging parameters (start or limit) are invalid.
    404 71200 The specified job ID was not found.
    404 71202 Results are not available yet because the job has not finished execution.
    404 71203 Results are not available because the job was canceled.
    404 71204 Results are not available because the job failed. More information might be available from the /errors endpoint.
    404 71210 No CAS library exists at the requested path. The specified CAS library is invalid.
    404 71211 The specified URI does not exist as the requested path.
    409 71201 The job must be canceled before it can be deleted.
    409 71207 The request could not be completed due to a conflict with the current state of the job. The job cannot be canceled because it has already completed.
    500 71208 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was fetching results.
    500 71208 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was storing the specified data.

    Categorization

    Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

    Categorizes natural language text documents according to a prebuilt or user-defined model.

    Base URLs:

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/ \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.api+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.api+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.api+json'
    }
    
    r = requests.get('https://www.example.com/categorization/', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /

    Returns a list of links to the top-level resources in this API.

    Example responses

    200

    {
      "version": 1,
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    
    Status Meaning Description Schema
    200 OK The request succeeded. A collection of link objects is available. Inline

    Check API availability

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/categorization/
    
    
    
    $.ajax({
      url: 'https://www.example.com/categorization/',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/categorization/', params={
    
    )
    
    print r.json()
    
    

    HEAD /

    Retrieves header information for the API resource. You can also use the request to check whether the service is available.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. API resource links are available. None

    Get a collection of jobs

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/jobs \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/categorization/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs

    Returns a collection of jobs that the server has processed or is currently processing for the current user. If no such jobs exist, an empty collection is returned.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering the collection. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting the collection. See Sorting in REST APIs.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "description": "string",
          "modelUri": "string",
          "outputTableNamePostfix": "string",
          "inputUri": "string",
          "documentIdVariable": "string",
          "textVariable": "string",
          "version": 0,
          "id": "string",
          "state": "pending",
          "creationTimeStamp": "2019-02-20T19:58:16Z"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The request returns all of the current jobs for the given user. categorizationJobs

    Check whether a collection of jobs exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/categorization/jobs
    
    
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/categorization/jobs', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs

    Retrieves header information for the collection of jobs. Can also be used to check whether the collection exists.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering the collection. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting the collection. See Sorting in REST APIs.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The collection is available. None

    Create a job to categorize a table of documents

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/categorization/jobs \
      -H 'Content-Type: application/vnd.sas.text.categorization.job.request+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.categorization.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.categorization.job.request+json',
      'Accept':'application/vnd.sas.text.categorization.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.categorization.job.request+json',
      'Accept': 'application/vnd.sas.text.categorization.job+json'
    }
    
    r = requests.post('https://www.example.com/categorization/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs

    Submits the data to be categorized using the specified model.

    Body parameter

    {
      "description": "string",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string"
    }
    

    Parameters

    Parameter In Type Required Description
    body body categorizationJobRequest true Indicates the data to perform categorization on.

    Example responses

    202

    {
      "description": "string",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:16Z"
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted The request has been accepted for categorization processing, but the processing has not been completed. categorizationJob
    400 Bad Request The request was invalid. The specified job request payload was not valid. The response contains details about why the payload is not valid. error2

    Create a job to categorize documents in the request

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/categorization/jobs#data \
      -H 'Content-Type: application/vnd.sas.text.categorization.job.request.documents+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.categorization.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.categorization.job.request.documents+json',
      'Accept':'application/vnd.sas.text.categorization.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs#data',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.categorization.job.request.documents+json',
      'Accept': 'application/vnd.sas.text.categorization.job+json'
    }
    
    r = requests.post('https://www.example.com/categorization/jobs#data', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs#data

    Submits the inline data to be categorized using the specified model.

    Body parameter

    {
      "description": "string",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "caslibUri": "string",
      "documents": [
        "string"
      ]
    }
    

    Parameters

    Parameter In Type Required Description
    body body categorizationJobRequestDocuments true Indicates the data to perform categorization on.

    Example responses

    202

    {
      "description": "string",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:16Z"
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted The request has been accepted for categorization processing, but the processing has not been completed. categorizationJob
    400 Bad Request The request was invalid. The supplied job request payload was not valid. The response contains details about why the payload is not valid. error2

    Get job information for a specific job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.categorization.job+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.text.categorization.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.text.categorization.job+json'
    }
    
    r = requests.get('https://www.example.com/categorization/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}

    Returns the current information about a job that was submitted to the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    200

    {
      "description": "string",
      "modelUri": "string",
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:16Z"
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Information about the job is returned. categorizationJob
    404 Not Found The specified job ID was not found. error2

    Check whether a job exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/categorization/jobs/{jobId}
    
    
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/categorization/jobs/{jobId}', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}

    Retrieves header information for a specific job. You can also use this request to check whether the job exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Information about the job header is available. None
    404 Not Found The specified job ID was not found. None

    Delete the specified job from the server

    Code samples

    # You can also use wget
    curl -X DELETE https://www.example.com/categorization/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: */*'
    
    
    var headers = {
      'Accept':'*/*'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}',
      method: 'delete',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': '*/*'
    }
    
    r = requests.delete('https://www.example.com/categorization/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    DELETE /jobs/{jobId}

    Deletes the job specified by jobId. If the job has not yet completed, the operation is canceled. The job data is then cleared from the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    404

    Responses

    Status Meaning Description Schema
    204 No Content The job data was deleted. None
    404 Not Found The specified job ID was not found. error2

    Get the state of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/jobs/{jobId}/state \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/state',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/categorization/jobs/{jobId}/state', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/state

    Gets the state of an existing job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current job state is available. taskState
    404 Not Found The specified job ID was not found. error2

    Check whether the state of a job exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/categorization/jobs/{jobId}/state
    
    
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/state',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/categorization/jobs/{jobId}/state', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/state

    Retrieves header information for the state of an existing job. You can also use this request to check whether the job exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current job state is available. None
    404 Not Found The specified job ID was not found. None

    Modify the state of an existing job

    Code samples

    # You can also use wget
    curl -X PUT https://www.example.com/categorization/jobs/{jobId}/state?value=canceled \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/state',
      method: 'put',
      data: '?value=canceled',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.put('https://www.example.com/categorization/jobs/{jobId}/state', params={
      'value': 'canceled'
    }, headers = headers)
    
    print r.json()
    
    

    PUT /jobs/{jobId}/state

    Updates the state of an existing job to a specific value. Currently this endpoint can be used only to cancel a running job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    value query string true Indicates the value to change the state of this job to.

    Enumerated Values

    Parameter Value
    value canceled

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The state was successfully updated. The response contains the updated state. taskState
    400 Bad Request The request was invalid. The specified state value is not a valid state. error2
    404 Not Found The specified job ID was not found. error2

    Get the results of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/jobs/{jobId}/results \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/results',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/categorization/jobs/{jobId}/results', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/results

    Retrieves the results of a job. Note that this endpoint is available only when the categorization job's state is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the categorization job for which a request is fetching results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "id": "string",
          "categories": [
            {
              "name": "string",
              "relevancy": 0,
              "terms": [
                {
                  "value": "string",
                  "startOffset": 0,
                  "endOffset": 0
                }
              ]
            }
          ],
          "version": 0
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The result of the job is available. categorizationJobResults
    404 Not Found No results were found for the specified job ID. For more information, see the /jobs/{jobId} endpoint. error2

    Check whether the results of a job exist

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/categorization/jobs/{jobId}/results
    
    
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/results',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/categorization/jobs/{jobId}/results', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/results

    Retrieves header information for the result of a specific job. You can also use this request to check whether the results exist. Note that this endpoint is available only when the categorization's state is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the categorization request for which a request is fetching results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The result of the job is available. None
    404 Not Found The result is not available. If available, find more information through the /jobs/{jobId} endpoint. None

    Get job errors

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/jobs/{jobId}/errors \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.error+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.error+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/errors',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.error+json'
    }
    
    r = requests.get('https://www.example.com/categorization/jobs/{jobId}/errors', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/errors

    Returns any errors that were generated as a result of a job. Note that the response might contain multiple errors via the nested errors array member. This endpoint is available only when the job state is failed. It is best accessed through the errors link from the job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Example responses

    200

    {
      "message": "string",
      "id": "string",
      "errorCode": 0,
      "httpStatusCode": 0,
      "details": [
        "string"
      ],
      "remediation": "string",
      "errors": [
        null
      ],
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The errors for the job are available. error2
    204 No Content The ID was found and there are no errors for this job. None
    404 Not Found The specified job ID was not found. error2

    Check whether errors exist for a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/categorization/jobs/{jobId}/errors
    
    
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/errors',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/categorization/jobs/{jobId}/errors', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/errors

    Retrieves header information for the job's errors. This request can also be used to check whether errors exist.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Errors are available. None
    404 Not Found The specified job ID was not found. None

    Get the log for a job as plain text

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/jobs/{jobId}/log \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/log',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/categorization/jobs/{jobId}/log', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log

    Gets the raw log for this job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log for the job is available. string
    404 Not Found The specified job ID was not found. error2

    Check whether the log for a job exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/categorization/jobs/{jobId}/log
    
    
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/log',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/categorization/jobs/{jobId}/log', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/log

    Retrieves header information for the log for this job. This request can also be used to check whether the log exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID for the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log is available. None
    404 Not Found The specified job ID was not found. None

    Get the log for a job as a collection of log lines

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/categorization/jobs/{jobId}/log#collection \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/categorization/jobs/{jobId}/log#collection',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/categorization/jobs/{jobId}/log#collection', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log#collection

    Returns the log from this job formatted as a collection of application/vnd.sas.compute.log.line objects.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "version": 1,
          "type": "normal",
          "line": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log is available for the job. logLineCollection
    404 Not Found The specified job ID was not found. error2

    Schemas

    taskState

    Properties

    Job State

    Name Type Required Description
    Job State string false Indicates the state of the job.
    Enumerated Values
    Property Value
    Job State pending
    Job State running
    Job State completed
    Job State canceled
    Job State failed

    baseCategorizationJobRequest

    Properties

    Common Job Request Properties

    Name Type Required Description
    description string false Indicates a brief description with details about a categorization job.
    modelUri string true Indicates a URI to a CAS table that contains one or more category model binaries.
    outputTableNamePostfix string false Indicates text to add to the end of the output table names. If left blank, the server generates text.

    categorizationJobRequest

    Properties

    Job Request for a Table

    Name Type Required Description
    Job Request for a Table any false Indicates a request to create a categorization job from a table. This is the application/vnd.sas.text.categorization.job.request media type.

    allOf

    Name Type Required Description
    anonymous baseCategorizationJobRequest false Indicates the common properties that can be specified for a job request.

    and

    Name Type Required Description
    anonymous object false
    » inputUri string true Indicates the URI to the table that contains the documents to categorize.
    » documentIdVariable string true Indicates the name of the variable in the table that contains the document ID.
    » textVariable string true Indicates the name of the variable in the table that contains the document text.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    categorizationJobRequestDocuments

    Properties

    Job Request for Documents in the Request

    Name Type Required Description
    Job Request for Documents in the Request any false Indicates a request to create a categorization job from inline documents. This is the application/vnd.sas.text.categorization.job.request.documents media type.

    allOf

    Name Type Required Description
    anonymous baseCategorizationJobRequest false Indicates the common properties that can be specified for a job request.

    and

    Name Type Required Description
    anonymous object false
    » caslibUri string true Indicates the URI to a caslib in which data is stored.
    » documents [string] true Indicates the text documents to categorize. These documents are identified in the order in which they are specified to the API, starting from 1 and proceeding sequentially.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    categorizationJob

    Properties

    Categorization Job

    Name Type Required Description
    Categorization Job any false Indicates a categorization job. This is the application/vnd.sas.text.categorization.job media type.

    allOf

    Name Type Required Description
    anonymous categorizationJobRequest false Indicates a request to create a categorization job from a table. This is the application/vnd.sas.text.categorization.job.request media type.

    and

    Name Type Required Description
    anonymous object false
    » id string true Indicates the server-generated ID that uniquely defines a categorization.
    » state taskState true Indicates the current state of a job.
    » creationTimeStamp string(date-time) true Indicates a string that contains the datetime value when a job was created in format yyyy-mm-ddThh:mm:ssZ.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    categorizationJobResults

    Properties

    Collection of Categorization Job Results

    Name Type Required Description
    Collection of Categorization Job Results any false Indicates the collection of categorization job results for the /results endpoint.

    allOf

    Name Type Required Description
    anonymous object false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)
    » name string false The name of the collection.
    » start integer(int64) false The zero-based index of the first item in the collection.
    » limit integer false The number of items that were requested for the collection.
    » count integer(int64) false The number of items in the collection.
    » accept string false A space-delimited list of media types from which an Accept header may be constructed.
    » links [any] false The links that apply to the collection.
    »» Link object false A link to a related operation or resource.
    »»» method string false The HTTP method for the link.
    »»» rel string true The relationship of the link to the resource.
    »»» uri string false The relative URI for the link.
    »»» href string false The URL for the link.
    »»» title string false The title for the link.
    »»» type string false The media type or link type for the link.
    »»» itemType string false If this is a link to a container, itemType is the media type or link type for the items in the container.
    »»» responseType string false The media type or link type of the response body for a PUT, POST, or PATCH operation.
    »»» responseItemType string false The media type or link type of the items in the response body for a PUT, POST, or PATCH operation.
    »» version integer false The version number of the collection representation. This representation is version 2.

    and

    Name Type Required Description
    » anonymous object false
    »» items [categorizationJobResult] true Indicates the collection of results. Each entry corresponds to results for one input document. Results are linked to input documents by the ID field.

    categorizationJobResult

    Properties

    Categorization Result

    Name Type Required Description
    id string true Indicates the document identifier that is associated with this result.
    categories [category] true Indicates the categorizations that were identified for this document.
    version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    category

    Properties

    Category

    Name Type Required Description
    name string true Indicates the name of the category that was found for this document.
    relevancy number(double) true Indicates a measurement of how relevant this category is to the original document.
    terms [term] true Indicates a list of terms that were identified for this category.

    term

    Properties

    Term

    Name Type Required Description
    value string true Indicates the text content of this term.
    startOffset integer(int32) true Indicates the index where the term begins relative to the original document.
    endOffset integer(int32) true Indicates the index where the term ends relative to the original document.

    categorizationJobs

    Properties

    Collection of Categorizations

    Name Type Required Description
    Collection of Categorizations any false

    allOf

    Name Type Required Description
    anonymous categorizationJobResults/allOf/0 false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [categorizationJob] false Indicates an array containing categorizations.

    logLineCollection

    Properties

    A Collection of Log Lines

    Name Type Required Description
    A Collection of Log Lines any false Indicates a collection of lines from the log file.

    allOf

    Name Type Required Description
    anonymous categorizationJobResults/allOf/0 false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [any] true
    »» Log Line object false A single line in a log. This is the application/vnd.sas.compute.log.line media type.
    »»» version integer(int32) true The version number of the Log Line (logLine) representation. This is version 1.
    »»» type string true The line entry classification.
    »»» line string true The line of text without the type (classification) prefix marker.
    Enumerated Values
    Property Value
    type normal
    type highlighted
    type source
    type title
    type byline
    type footnote
    type error
    type warning
    type note
    type message

    error2

    Properties

    Error

    Name Type Required Description
    message string false The message for the error.
    id string false The string ID for the error.
    errorCode integer false The numeric ID for the error.
    httpStatusCode integer true The HTTP status code for the error.
    details [string] false Messages that provide additional details about the cause of the error.
    remediation string false A message that describes how to resolve the error.
    errors [error2] false Any additional errors that occurred.
    links [categorizationJobResults/allOf/0/properties/links/items] false The links that apply to the error.
    version integer true The version number of the error representation. This representation is version 2.

    Usage Notes

    Overview

    The Categorization API allows a categorization model to be applied to a collection of documents. The categorization model defines the categories, the taxonomic structure in which the categories reside (think of organizing things in folder), and the rules defining how a document is considered a member of a category. A category is a label applied to a document.

    This API provides two different interactions for category scoring: scoring CAS tables containing documents and scoring documents that are uploaded directly into the API. In both cases, the API uses an asynchronous execution model. The client creates a categorization job that runs in the background after the Create operation returns. The API provides resource endpoints for checking the state of the job. Then, when complete, the results are retrieved using either the /results endpoint on the job, or by interacting with the result table directly by using another SAS API such as the Row Sets API.

    When scoring a table as input, the API views each row in the input table as a document. Thus, the API requires two input parameters: documentIdVariable and textVariable. The documentIdVariable is a unique identifier for the document and the textVariable is the actual document text. For example, consider a table containing tweets from @SASSoftware:

    ID Date Created Message
    850007368138018817 Thu Apr 06 15:28:43 +0000 2017 Real-time and #AI are changing marketing: join 9/13 #SASWebinar with special guest from @Forrester
    787452347508998458 Thu Apr 06 12:54:02 +0000 2017 US has over 4 million miles of roads that could have 10 million fully or semi autonomous cars by 2020 #IoT
    774598598680208850 Thu Apr 06 12:28:22 +0000 2017 Need help with your fight against #fraud?

    In this example, the documentIdVariable is ID and the textVariable is Message.

    The API supports the use of all models provided by SAS as well as user-created models. The modelUri input parameter takes a URI to a CAS table containing one or more category models.

    Terminology

    category

    a label that is assigned to a document. Multiple categories can be assigned to a single document. A categorization model typically contains multiple categories and the rules for matching those categories.

    job

    a container for an asynchronous operation. A job supports a number of different operations such as checking state, canceling an operation, fetching results, and so on. All categorization jobs are performed asynchronously.

    model

    a parameter that is used to determine what categories are assigned to a document. A model is represented in binary format in a CAS table. One CAS table can contain multiple models.

    library

    a container for inputs and outputs when you use CAS. Services such as Categorization use a library to locate input data and store output tables that they create.

    table

    the input for and the output from categorization. An input table must have both an ID column (documentIdVariable) and a column that contains the text data (textVariable). Additional columns can be included in an input table. Output tables are generated by the service.

    Resources

    Resource Relationships

    This diagram shows the relationships between the resources in this API.

    Categorization entity relationship diagram

    Root

    Path: /

    The root of the API. This resource contains links to the top-level resources in the API. The response uses the application/vnd.sas.api media type.

    The GET / response includes these links:

    Relation Method Description
    jobs GET Returns the first page of the collection of jobs.
    URI: /jobs
    Response type: application/vnd.sas.collection
    Response item type: application/vnd.sas.text.categorization.job
    startCategorization POST Submits a new categorization job for execution.
    URI: /jobs
    Request type: application/vnd.sas.text.categorization.job.request or application/vnd.sas.text.categorization.job.request.documents.
    Response type: application/vnd.sas.text.categorization.job

    Jobs

    Path: /jobs

    This API provides collections of jobs. Members of the /jobs collection are job resources, /job/{jobId}. (See below.)

    The GET operation on this path returns a application/vnd.sas.collection. This collection response includes these links:

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without the sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page of the collection.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    Sorting and Filtering

    This collection can be sorted and filtered using the ?sortBy= and ?filter= query parameters.

    Filtering and sorting can use these members of the Job resource:

    Job

    Path: /jobs/{jobId}

    A specific job resource. A job resource has the following link relations in the appication/vnd.sas.text.categorization.job representation.

    Relation Method Description
    self GET Returns the job itself.
    URI: /jobs/{jobId}
    Response type: application/vnd.sas.text.categorization.job
    delete DELETE Deletes the job.
    URI: /jobs/{jobId}
    state GET Returns the job state.
    URI: /jobs/{jobId}/state
    Response type: text/plain
    cancel PUT Cancels the job.1
    URI: /jobs/{jobId}/state?value=canceled
    results GET Returns the job results.2
    URI: /jobs/{jobId}/results
    Response type: application/vnd.sas.text.categorization.job.results
    errors GET Returns any errors associated with the job.3
    URI: /jobs/{jobId}/errors
    Response type: application/vnd.sas.error
    log GET Returns the log associated with the job.
    URI: /jobs/{jobId}/log
    Response type: text/plain or application/json
    caslib GET Returns the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib

    1 - Only available when the state of this job is 'pending' or 'running'.
    2 - Only available when the state of this job is 'completed'.
    3 - Only available when the state of this job is 'failed' or 'canceled'.

    Job Results

    Path: /jobs/{jobId}/results

    The results from categorization for a specific job. This path returns a collection of application.vnd.sas.categorization.job.result objects.

    The GET operation on this path returns a application/vnd.sas.collection. This collection response includes these links:

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without the sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page of the collection.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    documentCategorizationTable GET Returns the backing table for category results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    categorizationOffsetTable GET Returns the backing table for offset results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    documentScoreTable GET Returns the backing table for document category results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    caslib GET Returns the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib

    Media Types

    application/vnd.sas.text.categorization.job.request+json

    The vnd.sas.text.categorization.job.request media type represents a request to start a categorization job that processes a table as input.

    This is described by categorizationJobRequest.

    { "description": "My table request", "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/example", "outputTableNamePostfix": "-TMP", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/input", "documentIdVariable": "id", "textVariable": "text" }

    application/vnd.sas.text.categorization.job.request.documents+json

    The vnd.sas.text.categorization.job.request.documents media type represents a request to start a categorization job that processes the documents provided in the request payload.

    This is described by categorizationJobRequestDocuments.

    { "description": "My inline document request", "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/example", "outputTableNamePostfix": "-TMP", "caslibUri": "/casManagement/servers/cas/caslibs/lib", "documents": ["This text to categorize.", "This additional document to categorize"] }

    application/vnd.sas.text.categorization.job+json

    The vnd.sas.text.categorization.job media type represents a job created to perform categorization. That job could have been started to process a CAS table using the application/vnd.sas.text.categorization.job.request media type, or it could be processing documents that were uploaded directly using the application/vnd.sas.text.categorization.job.request.documents media type.

    This is described by categorizationJob.

    { "version": 1, "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/model", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/user-7387a394-7e08-48f7-bcff-db4051c077c3", "documentIdVariable": "id", "textVariable": "text", "id": "873895dc-5ea3-4aac-a136-f582f9d35da3", "state": "completed", "creationTimeStamp": "2017-09-08T13:30:53.072Z", "links": [ { "method": "GET", "rel": "self", "href": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3", "uri": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3", "type": "application/vnd.sas.text.categorization.job" }, { "method": "DELETE", "rel": "delete", "href": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3", "uri": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3" }, { "method": "GET", "rel": "state", "href": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/state", "uri": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/state", "type": "text/plain" }, { "method": "GET", "rel": "log", "href": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/log", "uri": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/log", "type": "text/plain" }, { "method": "GET", "rel": "results", "href": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/results", "uri": "/categorization/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/results", "type": "application/vnd.sas.collection" }, { "method": "GET", "rel": "caslib", "href": "/casManagement/servers/cas/caslibs/lib", "uri": "/casManagement/servers/cas/caslibs/lib", "type": "application/vnd.sas.cas.caslib" } ] }

    application/vnd.sas.text.categorization.job.result+json

    The vnd.sas.text.categorization.job.result media type represents the categorization of a specific document regardless of whether the document came from an input table or was uploaded directly into the job.

    This is described by categorizationJobResult.

    { "version": 1, "id": "r1000", "categories": [ { "name": "Top/04000000 - Economy, Business and Finance", "relevancy": 2, "terms": [ { "value": "xbox", "startOffset": 9, "endOffset": 12 }, { "value": "xbox", "startOffset": 248, "endOffset": 251 } ] }, { "name": "Top/04000000 - Economy, Business and Finance/04003000 - Computing and Information Technology", "relevancy": 2, "terms": [ { "value": "xbox", "startOffset": 9, "endOffset": 12 }, { "value": "xbox", "startOffset": 248, "endOffset": 251 } ] } ] }

    application/vnd.sas.text.categorization.category+json

    The application/vnd.sas.text.categorization.category media type represents a category for a matched document.

    This is described by category.

    { "name": "Top/04000000 - Economy, Business and Finance/04003000 - Computing and Information Technology", "relevancy": 2, "terms": [ { "value": "xbox", "startOffset": 9, "endOffset": 12 }, { "value": "xbox", "startOffset": 248, "endOffset": 251 } ] }

    application/vnd.sas.text.categorization.term+json

    The application/vnd.sas.text.categorization.term media type represents a term that contributed to a category match. The application/vnd.sas.text.categorization.category media type contains a collection of these.

    This is described by term.

    { "value": "xbox", "startOffset": 9, "endOffset": 12 }

    application/vnd.sas.api

    Contains top-level links for an API. See application/vnd.sas.api.

    application/vnd.sas.collection

    A paginated, filterable, sortable collection of resource representations. See application/vnd.sas.collection.

    application/vnd.sas.error

    A detailed description of an error. See application/vnd.sas.error.

    application/vnd.sas.compute.log.line

    A single line from a log file. For this service, the log is created by the execution of a job. See application/vnd.sas.compute.log.line.

    Error Codes

    HTTP Status Code Error Code Description
    400 71205 The request was invalid. The specified state value is not a valid state.
    400 71206 The request was invalid. The specified state value is not a valid state. Only the state 'canceled' is permitted.
    400 71212 The specified paging parameters (start or limit) are invalid.
    404 71200 The specified job ID was not found.
    404 71202 Results are not available yet because the job has not finished execution.
    404 71203 Results are not available because the job was canceled.
    404 71204 Results are not available because the job failed. More information might be available from the /errors endpoint.
    404 71210 No CAS library exists at the requested path. The specified CAS library is invalid.
    404 71211 The specified URI does not exist as the requested path.
    409 71201 The job must be canceled before it can be deleted.
    409 71207 The request could not be completed due to a conflict with the current state of the job. The job cannot be canceled because it has already completed.
    500 71208 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was fetching results.
    500 71209 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was storing the specified data.

    Concepts

    Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

    Assigns concepts to natural language text documents according to a prebuilt or user-defined model.

    Base URLs:

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/ \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.api+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.api+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.api+json'
    }
    
    r = requests.get('https://www.example.com/concepts/', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /

    Returns a list of top-level resource links in this API.

    Example responses

    200

    {
      "version": 1,
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    
    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The request returned a collection of link objects. api

    Get header information for an API resource

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/
    
    
    
    $.ajax({
      url: 'https://www.example.com/concepts/',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/concepts/', params={
    
    )
    
    print r.json()
    
    

    HEAD /

    Retrieves header information for the API resource. You can also use the request to check whether the service is available.

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. API resource links are available. None

    Get job information

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs

    Returns a collection of jobs that the server has processed or is currently processing for the current user. If no such jobs exist, an empty collection is returned.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering the collection. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting the collection. See Sorting in REST APIs.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "description": "string",
          "modelUri": "string",
          "language": "ar",
          "matchType": "all",
          "enableFacts": true,
          "outputTableNamePostfix": "string",
          "inputUri": "string",
          "documentIdVariable": "string",
          "textVariable": "string",
          "version": 0,
          "id": "string",
          "state": "pending",
          "creationTimeStamp": "2019-02-20T19:58:17Z"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The request returns all of the current jobs for the given user. conceptsJobs

    Get header information for a job collection

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs
    
    
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/concepts/jobs', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs

    Retrieves header information for the collection of jobs that the server has processed or is currently processing for the current user. Can also be used to check whether the collection exists.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering a collection. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting the collection. See Sorting in REST APIs.

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The collection is available. None

    Create a job to conceptualize documents

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/concepts/jobs \
      -H 'Content-Type: application/vnd.sas.text.concepts.job.request+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.concepts.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.concepts.job.request+json',
      'Accept':'application/vnd.sas.text.concepts.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.concepts.job.request+json',
      'Accept': 'application/vnd.sas.text.concepts.job+json'
    }
    
    r = requests.post('https://www.example.com/concepts/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs

    Submits the data to be conceptualized using the specified model.

    Body parameter

    {
      "description": "string",
      "modelUri": "string",
      "language": "ar",
      "matchType": "all",
      "enableFacts": true,
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string"
    }
    

    Parameters

    Parameter In Type Required Description
    body body conceptsJobRequest true Indicates the data to perform concept scoring on.

    Example responses

    202

    {
      "description": "string",
      "modelUri": "string",
      "language": "ar",
      "matchType": "all",
      "enableFacts": true,
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:17Z"
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted Indicates that the request has been accepted for concept scoring, but the processing has not been completed. conceptsJob
    400 Bad Request Indicates that the request was invalid. The specified job request payload was not valid. The response contains more details about why the payload is not valid. error2

    Create a job to conceptualize documents in a request

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/concepts/jobs#data \
      -H 'Content-Type: application/vnd.sas.text.concepts.job.request.documents+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.concepts.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.concepts.job.request.documents+json',
      'Accept':'application/vnd.sas.text.concepts.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs#data',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.concepts.job.request.documents+json',
      'Accept': 'application/vnd.sas.text.concepts.job+json'
    }
    
    r = requests.post('https://www.example.com/concepts/jobs#data', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs#data

    Submits the inline data to be conceptualized using the specified model.

    Body parameter

    {
      "description": "string",
      "modelUri": "string",
      "language": "ar",
      "matchType": "all",
      "enableFacts": true,
      "outputTableNamePostfix": "string",
      "caslibUri": "string",
      "documents": [
        "string"
      ]
    }
    

    Parameters

    Parameter In Type Required Description
    body body conceptsJobRequestDocuments true Indicates the data to perform concept scoring on.

    Example responses

    202

    {
      "description": "string",
      "modelUri": "string",
      "language": "ar",
      "matchType": "all",
      "enableFacts": true,
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:17Z"
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted Indicates that the request has been accepted for concept scoring, but the processing has not been completed. conceptsJob
    400 Bad Request Indicates that the request was invalid. The specified job request payload was not valid. The response contains more details about why the payload is not valid. error2

    Get information about a specific job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.concepts.job+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.text.concepts.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.text.concepts.job+json'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}

    Returns the current information about a job that was submitted to the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    200

    {
      "description": "string",
      "modelUri": "string",
      "language": "ar",
      "matchType": "all",
      "enableFacts": true,
      "outputTableNamePostfix": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:17Z"
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. conceptsJob
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Get header information for a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: */*'
    
    
    var headers = {
      'Accept':'*/*'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}',
      method: 'head',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': '*/*'
    }
    
    r = requests.head('https://www.example.com/concepts/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    HEAD /jobs/{jobId}

    Retrieves header information for a specific job. You can also use this request to check whether the job exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    404

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. None
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Delete a concept job from the server

    Code samples

    # You can also use wget
    curl -X DELETE https://www.example.com/concepts/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: */*'
    
    
    var headers = {
      'Accept':'*/*'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}',
      method: 'delete',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': '*/*'
    }
    
    r = requests.delete('https://www.example.com/concepts/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    DELETE /jobs/{jobId}

    Deletes the job that is specified by jobId. If the job has not yet completed, the operation is canceled. The job data is then cleared from the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    404

    Responses

    Status Meaning Description Schema
    204 No Content Indicates that the job data was deleted. None
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Get the state of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId}/state \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/state',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}/state', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/state

    Gets the state of an existing job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of a job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. taskState
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Get header information about the state of a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs/{jobId}/state
    
    
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/state',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/concepts/jobs/{jobId}/state', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/state

    Retrieves header information about the state of a job. You can also use this request to check whether the job exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of a job.

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The current job state is available. None
    404 Not Found Indicates that the specified ID does not exist at the requested path. None

    Modify the state of a job

    Code samples

    # You can also use wget
    curl -X PUT https://www.example.com/concepts/jobs/{jobId}/state?value=canceled \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/state',
      method: 'put',
      data: '?value=canceled',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.put('https://www.example.com/concepts/jobs/{jobId}/state', params={
      'value': 'canceled'
    }, headers = headers)
    
    print r.json()
    
    

    PUT /jobs/{jobId}/state

    Updates the state of an existing job to a specific value. Currently this endpoint can be used only to cancel a running job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    value query string true Indicates the value to change the state of this job to.

    Enumerated Values

    Parameter Value
    value canceled

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The state was successfully updated. The response contains the updated state. taskState
    400 Bad Request Indicates that the request was invalid. The specified state value is invalid. error2
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId}/results \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.api+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.api+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/results',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.api+json'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}/results', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/results

    Retrieves links to the concept results of a job. If facts were enabled for this job, a link to this job's fact results are included. Note that this endpoint is available only when the concept job's state is completed.

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the concepts job for which a request is fetching results.

    Example responses

    200

    {
      "version": 1,
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    
    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The request returned links to the results of this job. api
    404 Not Found Indicates that the result is not available at the requested path. If available, find more information through the /jobs/{jobId} endpoint. error2

    Get header information for the result of a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs/{jobId}/results
    
    
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/results',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/concepts/jobs/{jobId}/results', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/results

    Retrieves header information for the results of a job. You can also use this request to check whether the results exist. Note that this endpoint is available only when the concept job's state is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the concepts job for which a request is fetching results.

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The result of the job is available. None
    404 Not Found Indicates that no result exists at the requested path. If available, find more information through the /jobs/{jobId} endpoint. None

    Get the concept results of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId}/results/concepts \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/results/concepts',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}/results/concepts', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/results/concepts

    Retrieves the concept results of a job. Note that this endpoint is available only when the concept job's state is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the concepts job for which a request is fetching results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "id": "string",
          "concepts": [
            {
              "name": "string",
              "term": "string",
              "startOffset": 0,
              "endOffset": 0
            }
          ],
          "version": 0
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The concept results of the job are available. conceptResults
    404 Not Found Indicates that no result exists at the requested path. If available, find more information through the /jobs/{jobId} endpoint. error2

    Get header information for the concept results of a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs/{jobId}/results/concepts
    
    
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/results/concepts',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/concepts/jobs/{jobId}/results/concepts', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/results/concepts

    Retrieves header information for the concept results of a job. You can also use this request to check whether the results exist. Note that this endpoint is available only when the concept job's state is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the concepts job for which a request is fetching concept results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The concept results of the job are available. None
    404 Not Found Indicates that no concept results exist at the requested path. If available, find more information through the /jobs/{jobId} endpoint. None

    Get the fact results of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId}/results/facts \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/results/facts',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}/results/facts', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/results/facts

    Retrieves the fact results of a job. Note that this endpoint is available only when the concept job's state is completed and when facts were enabled in the job request.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the concepts job for which a request is fetching fact results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "id": "string",
          "facts": [
            {
              "name": "string",
              "term": "string",
              "startOffset": 0,
              "endOffset": 0,
              "arguments": [
                {
                  "name": "string",
                  "matchedText": "string"
                }
              ]
            }
          ],
          "version": 0
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The fact results of the job are available. factResults
    404 Not Found Indicates that no fact results exist at the requested path. If available, find more information through the /jobs/{jobId} endpoint. error2

    Get header information for the fact results of a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs/{jobId}/results/facts
    
    
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/results/facts',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/concepts/jobs/{jobId}/results/facts', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/results/facts

    Retrieves header information for the fact results of a job. You can also use this request to check whether the results exist. Note that this endpoint is available only when the concept job's state is completed and when facts are enabled in the job request.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the concepts job for which a request is fetching fact results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The fact results of the job are available. None
    404 Not Found Indicates that no fact results exist at the requested path. If available, find more information through the /jobs/{jobId} endpoint. None

    Get job errors

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId}/errors \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.error+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.error+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/errors',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.error+json'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}/errors', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/errors

    Gets any errors that were generated as a result of a job. Note that the response might contain multiple errors via the nested errors array member. This endpoint is available only when the job state is failed. It is best accessed through the errors link from the job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    200

    {
      "message": "string",
      "id": "string",
      "errorCode": 0,
      "httpStatusCode": 0,
      "details": [
        "string"
      ],
      "remediation": "string",
      "errors": [
        null
      ],
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. All of the job's errors are available. error2
    204 No Content Indicates that the ID was found and there are no errors for this job. None
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Get header information for job errors

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs/{jobId}/errors
    
    
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/errors',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/concepts/jobs/{jobId}/errors', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/errors

    Retrieves header information for the job's errors. This request can also be used to check whether errors exist.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. Errors are available. None
    404 Not Found Indicates that the specified ID does not exist at the requested path. None

    Get the log for a job as plain text

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId}/log \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/log',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}/log', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log

    Gets the raw log from this job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. This job's log is available. string
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Retrieve header information for a job log

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/concepts/jobs/{jobId}/log \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: */*'
    
    
    var headers = {
      'Accept':'*/*'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/log',
      method: 'head',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': '*/*'
    }
    
    r = requests.head('https://www.example.com/concepts/jobs/{jobId}/log', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/log

    Retrieves header information for the job log. This request can also be used to check whether the log exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    404

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. The log is available. None
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Get a job log as a collection of log lines

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/concepts/jobs/{jobId}/log#collection \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/concepts/jobs/{jobId}/log#collection',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/concepts/jobs/{jobId}/log#collection', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log#collection

    Gets the log from this job formatted as a collection of application/vnd.sas.compute.log.line objects.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "version": 1,
          "type": "normal",
          "line": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK Indicates that the request succeeded. This job's log is available. logLineCollection
    404 Not Found Indicates that the specified ID does not exist at the requested path. error2

    Schemas

    taskState

    Properties

    Job State

    Name Type Required Description
    Job State string false Indicates the state of the task.
    Enumerated Values
    Property Value
    Job State pending
    Job State running
    Job State completed
    Job State canceled
    Job State failed

    language

    Properties

    Language

    Name Type Required Description
    Language string false Indicates the two letter ISO 639-1 value for selecting a language.
    Enumerated Values
    Property Value
    Language ar
    Language cs
    Language da
    Language de
    Language el
    Language en
    Language es
    Language fa
    Language fi
    Language fr
    Language he
    Language hi
    Language hr
    Language id
    Language it
    Language ja
    Language ko
    Language nl
    Language no
    Language pl
    Language pt
    Language ru
    Language sk
    Language sl
    Language sv
    Language th
    Language tl
    Language tr
    Language vi
    Language zh

    matchType

    Properties

    Match Type

    Name Type Required Description
    Match Type string false Indicates the match type value.
    Enumerated Values
    Property Value
    Match Type all
    Match Type longest
    Match Type best

    baseConceptsJobRequest

    Properties

    Common Job Request Properties

    Name Type Required Description
    description string false Provides a brief description that gives details about this concept job request.
    modelUri string false Indicates the URI to a CAS table that contains one or more concept model binaries. If left blank, the default model for the specified language is used.
    language language true Indicates the language of the input data.
    matchType matchType false Indicates the type of matches to return. If left blank, the results contain all matches.
    enableFacts boolean false Contains a Boolean value that indicates whether to enable facts in the results. By default, facts are disabled.
    outputTableNamePostfix string false Indicates text to add to the end of the output table names. If left blank the server generates text.

    conceptsJobRequest

    Properties

    Job Request for a Table

    Name Type Required Description
    Job Request for a Table any false Indicates a request that creates a concepts job from a table. This is the application/vnd.sas.text.concepts.job.request media type.

    allOf

    Name Type Required Description
    anonymous baseConceptsJobRequest false Indicates the common properties that can be specified for any job request.

    and

    Name Type Required Description
    anonymous object false
    » inputUri string true Indicates the URI to the table that contains the documents to conceptualize.
    » documentIdVariable string true Indicates the name of the variable in the table that contains the ID.
    » textVariable string true Indicates the name of the variable in the table that contains the document text.
    » version integer(int32) true Indicates this media type's schema version number. This representation is version 1.

    conceptsJobRequestDocuments

    Properties

    Job Request for Documents in the Request

    Name Type Required Description
    Job Request for Documents in the Request any false Indicates a request that creates a concepts job from inline documents. This is the application/vnd.sas.text.concepts.job.request.documents media type.

    allOf

    Name Type Required Description
    anonymous baseConceptsJobRequest false Indicates the common properties that can be specified for any job request.

    and

    Name Type Required Description
    anonymous object false
    » caslibUri string true Indicates the URI that points to a caslib in which the data is stored.
    » documents [string] true Indicates the text documents to conceptualize. These documents are identified sequentially in the order in which they are specified to the service, starting from 1.
    » version integer(int32) true This media type's schema version number. This representation is version 1.

    conceptsJob

    Properties

    Concepts Job

    Name Type Required Description
    Concepts Job any false Indicates a concepts job. This is the application/vnd.sas.text.concepts.job media type.

    allOf

    Name Type Required Description
    anonymous conceptsJobRequest false Indicates a request that creates a concepts job from a table. This is the application/vnd.sas.text.concepts.job.request media type.

    and

    Name Type Required Description
    anonymous object false
    » id string true Indicates the server-generated ID that uniquely defines this concept job.
    » state taskState true Indicates the current state of this job.
    » creationTimeStamp string(date-time) true Indicates a string that contains the datetime value when a job was originally created in format yyyy-mm-ddThh:mm:ssZ.
    » version integer(int32) true Indicates this media type's schema version number. This representation is version 1.

    conceptResults

    Properties

    Collection of Concept Results from a Job

    Name Type Required Description
    Collection of Concept Results from a Job any false Indicates the collection of concept results from a job for the /results/concepts endpoint.

    allOf

    Name Type Required Description
    anonymous object false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)
    » name string false The name of the collection.
    » start integer(int64) false The zero-based index of the first item in the collection.
    » limit integer false The number of items that were requested for the collection.
    » count integer(int64) false The number of items in the collection.
    » accept string false A space-delimited list of media types from which an Accept header may be constructed.
    » links [any] false The links that apply to the collection.
    »» Link object false A link to a related operation or resource.
    »»» method string false The HTTP method for the link.
    »»» rel string true The relationship of the link to the resource.
    »»» uri string false The relative URI for the link.
    »»» href string false The URL for the link.
    »»» title string false The title for the link.
    »»» type string false The media type or link type for the link.
    »»» itemType string false If this is a link to a container, itemType is the media type or link type for the items in the container.
    »»» responseType string false The media type or link type of the response body for a PUT, POST, or PATCH operation.
    »»» responseItemType string false The media type or link type of the items in the response body for a PUT, POST, or PATCH operation.
    »» version integer false The version number of the collection representation. This representation is version 2.

    and

    Name Type Required Description
    » anonymous object false
    »» items [conceptResult] true Indicates the collection of concept results. Each entry corresponds to the result for one input document. Results are linked to input documents by the ID field.

    conceptResult

    Properties

    Concept Result

    Name Type Required Description
    id string true Indicates the document identifier that is associated with this result.
    concepts [concept] true [Indicates a single concept. This is the application/vnd.sas.text.concepts.concept media type.]
    version integer(int32) true Indicates this media type's schema version number. This representation is version 1.

    concept

    Properties

    Concept

    Name Type Required Description
    name string true Indicates the name of the concept that was matched.
    term string true Indicates the term that matched the concept.
    startOffset integer(int32) true Indicates the start offset of the match.
    endOffset integer(int32) true Indicates the end offset of the match.

    conceptsJobs

    Properties

    Collection of Concept Jobs

    Name Type Required Description
    Collection of Concept Jobs any false

    allOf

    Name Type Required Description
    anonymous conceptResults/allOf/0 false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [conceptsJob] false Indicates an array that contains concepts jobs.

    factResults

    Properties

    Collection of Concept Job Fact Results

    Name Type Required Description
    Collection of Concept Job Fact Results any false Indicates the collection of fact results for the /results/facts endpoint.

    allOf

    Name Type Required Description
    anonymous conceptResults/allOf/0 false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [factResult] true Indicates the collection of fact results where each entry corresponds to the result for one input document. Results are linked to input documents by the 'id' field.

    factResult

    Properties

    Fact Result

    Name Type Required Description
    id string true Indicates the document identifier that is associated with the result.
    facts [fact] true [Indicates a single fact. This is the application/vnd.sas.text.concepts.fact media type.]
    version integer(int32) true Indicates this media type's schema version number. This representation is version 1.

    fact

    Properties

    Fact

    Name Type Required Description
    Fact any false Indicates a single fact. This is the application/vnd.sas.text.concepts.fact media type.

    allOf

    Name Type Required Description
    anonymous concept false Indicates a single concept. This is the application/vnd.sas.text.concepts.concept media type.

    and

    Name Type Required Description
    anonymous object false
    » arguments [argument] true [Indicates a single fact argument. This is the application/vnd.sas.text.concepts.fact.argument media type.]

    argument

    Properties

    Argument

    Name Type Required Description
    name string true Indicates the name of the argument.
    matchedText string true Indicates the text that the argument is matched with.

    logLineCollection

    Properties

    A Collection of Log Lines

    Name Type Required Description
    A Collection of Log Lines any false Indicates the collection of lines from the log file.

    allOf

    Name Type Required Description
    anonymous conceptResults/allOf/0 false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [any] true
    »» Log Line object false A single line in a log. This is the application/vnd.sas.compute.log.line media type.
    »»» version integer(int32) true The version number of the Log Line (logLine) representation. This is version 1.
    »»» type string true The line entry classification.
    »»» line string true The line of text without the type (classification) prefix marker.
    Enumerated Values
    Property Value
    type normal
    type highlighted
    type source
    type title
    type byline
    type footnote
    type error
    type warning
    type note
    type message

    error2

    Properties

    Error

    Name Type Required Description
    message string false The message for the error.
    id string false The string ID for the error.
    errorCode integer false The numeric ID for the error.
    httpStatusCode integer true The HTTP status code for the error.
    details [string] false Messages that provide additional details about the cause of the error.
    remediation string false A message that describes how to resolve the error.
    errors [error2] false Any additional errors that occurred.
    links [conceptResults/allOf/0/properties/links/items] false The links that apply to the error.
    version integer true The version number of the error representation. This representation is version 2.

    api

    Properties

    API

    Name Type Required Description
    version integer true The version number of the API representation. This is version 1.
    links [conceptResults/allOf/0/properties/links/items] true The API's top-level links.

    Usage Notes

    Overview

    The Concepts Scoring API allows a concept model to be applied to a collection of documents. The concept model defines the concepts, the taxonomic structure in which the concepts reside (think of organizing things in folders), and the rules that define how a region of text is assigned to a specific concept.

    This API provides two different interactions for concepts: scoring CAS tables that contain documents and scoring documents that are uploaded directly into the API. In both cases, the API uses an asynchronous execution model. The client creates a concepts job that runs in the background after the operation returns. The API provides resource endpoints for checking the state of the job. Then, when complete, the results are retrieved by using either the /results endpoint on the job, or by interacting with the result table directly by using another SAS API such as the Row Sets API.

    One of the values the API takes as input is a language parameter. For English, the language parameter must take the form of en (ISO-639-1 short code for English). The language parameter is used to select the concept binary model that scores the documents if a custom binary is not provided. The language binaries are considered to be domain-independent because they are designed to work across different domains.

    The API takes an optional matchType parameter as input. The match type indicates what matches to return. Possible values for matchType are all, best, and longest. If the user chooses all, all of the terms that match any of the LITI concept definitions in the model are returned. With best, only matches with the highest priority setting are returned. The longest match type returns the longest match for the concept definition. The API returns all matches by default.

    When scoring a table as input, the API views each row in the input table as a document. Thus, the API requires two input parameters: documentIdVariable and textVariable. The documentIdVariable is a unique identifier for the document and the textVariable is the actual document text. For example, consider a table containing tweets from @SASSoftware:

    ID Date Created Message
    850007368138018817 Thu Apr 06 15:28:43 +0000 2017 Real-time and #AI are changing marketing: join 9/13 #SASWebinar with special guest from @Forrester
    787452347508998458 Thu Apr 06 12:54:02 +0000 2017 US has over 4 million miles of roads that could have 10 million fully or semi autonomous cars by 2020 #IoT
    774598598680208850 Thu Apr 06 12:28:22 +0000 2017 Need help with your fight against #fraud?

    In this example, the documentIdVariable is ID and the textVariable is Message.

    The API supports the use of the default models that are associated with each language as well as user-created models. The modelUri input parameter takes a URI to a CAS table containing one or more concept models.

    Terminology

    concept

    a property, such as a book title, last name, city, gender, and so on. Concepts are created from one or more rules that are defined in language interpretation and text interpretation (LITI) syntax.

    fact (predicate)

    two or more pieces of related information, often contained within the same sentence. Facts are identified by using either the PREDICATE_RULE or SEQUENCE concept rule.

    job

    a container for an asynchronous operation. A job supports a number of different operations such as checking a state, canceling an operation, fetching results, and so on. All concept jobs are performed asynchronously.

    language

    a parameter that specifies which domain-independent concept model to use for processing input documents. This parameter is required when you process tables or uploaded documents. For English, the language parameter must take the form of "en" (see ISO-639-1 short codes).

    library

    a container for inputs and outputs when you use CAS. Services, such as concepts, use a library to locate input data and to store output tables that they create.

    model

    a parameter that is used to determine what concepts are assigned to a document. A model is represented in binary format in a CAS table. One CAS table can contain multiple models.

    table

    the input to and output from concept scoring. An input table for concept scoring must have both an ID column (documentIdVariable) and a column that contains text data (textVariable). Additional columns can be included in an input table. Output tables are generated by the service.

    Resources

    Resource Relationships

    The diagram below shows the relationships between the resources in this API.

    Concepts entity relationship diagram

    Root

    Path: /

    The root of the API. This resource contains links to the top-level resources in the API. The response uses the application/vnd.sas.api media type.

    The GET / response includes these links.

    Relation Method Description
    jobs GET Returns the first page of the collection of jobs.
    URI: /jobs
    Response type: application/vnd.sas.collection
    Response item type: application/vnd.sas.text.concepts.job
    startConcepts POST Submits a new concepts job for execution.
    URI: /jobs
    Request type: application/vnd.sas.text.concepts.job.request or application/vnd.sas.text.concepts.job.request.documents.
    Response type: application/vnd.sas.text.concepts.job

    Jobs

    Path: /jobs

    This API provides collections of jobs. Members of the /jobs collection are job resources, /job/{jobId}. (See below.)

    The GET operation on this path returns a application/vnd.sas.collection. This collection response includes the links in this table.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without the sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    Sorting and Filtering

    This collection can be sorted and filtered using the ?sortBy= and ?filter= query parameters.

    Filtering and sorting uses these members of the Job resource:

    Job

    Path: /jobs/{jobId}

    A specific job resource.

    A job resource has the link relations that are described in this table in the application/vnd.sas.text.concepts.job representation.

    Relation Method Description
    self GET Gets the job itself.
    URI: /jobs/{jobId}
    Response type: application/vnd.sas.text.concepts.job
    delete DELETE Deletes the job.
    URI: /jobs/{jobId}
    state GET Gets the job state.
    URI: /jobs/{jobId}/state
    Response type: text/plain
    cancel PUT Cancels the job.1
    URI: /jobs/{jobId}/state?value=canceled
    results GET Gets the job results.2
    URI: /jobs/{jobId}/results
    Response type: application/vnd.sas.text.concepts.job.results
    errors GET Gets any errors that are associated with the job.3
    URI: /jobs/{jobId}/errors
    Response type: application/vnd.sas.error
    log GET Gets the log that is associated with the job.
    URI: /jobs/{jobId}/log
    Response type: text/plain or application/json
    caslib GET Gets the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib

    1 Only available when this job's state is 'pending' or 'running'.
    2 Only available when this job's state is 'completed'.
    3 Only available when this job's state is 'failed' or 'canceled'.

    Job Results

    Path: /jobs/{jobId}/results

    The results from a specific concepts job. This path returns links to the resources that are available as results from this job.

    The GET operation on this path returns a application/vnd.sas.api representation including the links that are described in this table.

    Relation Method Description
    self GET Returns the current result links.
    up GET Returns the parent resource.
    caslib GET Gets the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib
    concepts GET Gets the job concept results.
    URI: /jobs/{jobId}/results/concepts
    Response type: application/vnd.sas.collection
    Response item type: application/vnd.sas.text.concepts.concept.result
    conceptsTable GET Gets the backing table for the concept results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    facts GET Gets the job fact results (if enabled).
    URI: /jobs/{jobId}/results/facts
    Response type: application/vnd.sas.collection
    Response item type: application/vnd.sas.text.concepts.fact.result
    factsTable GET Gets the backing table for the individual facts.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table

    Concept Job Results

    Path: /jobs/{jobId}/results/concepts

    This path provides collections of concepts.

    The GET operation on this path returns a application/vnd.sas.collection collection. This collection response includes the links that are described in this table.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without the sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    caslib GET Gets the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib
    conceptsTable GET Gets the backing table for the concept results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table

    Job Fact Results

    Path: /jobs/{jobId}/results/facts

    This path provides collections of facts.

    The GET operation on this path returns a application/vnd.sas.collection collection. This collection response includes the links that are described in this table.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without the sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    caslib GET Gets the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib
    factsTable GET Gets the backing table for the individual facts.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table

    Media Types

    application/vnd.sas.text.concepts.job.request+json

    The vnd.sas.text.concepts.job.request media type represents a request to start a concepts job that processes a table as input.

    This is described by conceptsJobRequest.

    { "description": "My table request", "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/example", "language": "en", "matchType": "all", "enableFacts": true, "outputTableNamePostfix": "-TMP", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/input", "documentIdVariable": "id", "textVariable": "text" }

    application/vnd.sas.text.concepts.job.request.documents+json

    The vnd.sas.text.concepts.job.request.documents media type represents a request to start a concepts job that processes the documents that are provided in the request payload.

    This is described by conceptsJobRequestDocuments.

    { "description": "My inline document request", "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/example", "language": "en", "matchType": "all", "enableFacts": true, "outputTableNamePostfix": "-TMP", "caslibUri": "/casManagement/servers/cas/caslibs/lib", "documents": ["This text to conceptualize.", "This additional document to conceptualize"] }

    application/vnd.sas.text.concepts.job+json

    The vnd.sas.text.concepts.job media type represents a job that conceptualizes data. That job might be processing a CAS table by using the application/vnd.sas.text.concepts.job.request media type, or it might be processing documents that were uploaded directly by using the application/vnd.sas.text.concepts.job.request.documents media type.

    This is described by conceptsJob.

    { "version": 1, "modelUri": "/casManagement/servers/cas/caslibs/lib/tables/model", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/user-7387a394-7e08-48f7-bcff-db4051c077c3", "documentIdVariable": "id", "textVariable": "text", "id": "873895dc-5ea3-4aac-a136-f582f9d35da3", "state": "completed", "creationTimeStamp": "2017-09-08T13:30:53.072Z", "links": [ { "method": "GET", "rel": "self", "href": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3", "uri": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3", "type": "application/vnd.sas.text.concepts.job" }, { "method": "DELETE", "rel": "delete", "href": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3", "uri": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3" }, { "method": "GET", "rel": "state", "href": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/state", "uri": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/state", "type": "text/plain" }, { "method": "GET", "rel": "log", "href": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/log", "uri": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/log", "type": "text/plain" }, { "method": "GET", "rel": "results", "href": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/results", "uri": "/concepts/jobs/873895dc-5ea3-4aac-a136-f582f9d35da3/results", "type": "application/vnd.sas.collection" }, { "method": "GET", "rel": "caslib", "href": "/casManagement/servers/cas/caslibs/lib", "uri": "/casManagement/servers/cas/caslibs/lib", "type": "application/vnd.sas.cas.caslib" } ] }

    application/vnd.sas.text.concepts.concept.result+json

    The vnd.sas.text.concepts.concept.result media type represents the concepts of a specific document regardless of whether the document came from an input table or was uploaded directly into the job.

    This is described by conceptResult.

    { "version": 1, "id": "1", "concepts": [ { "name": "nlpNounGroup", "term": "sweltering summer", "startOffset": 77, "endOffset": 93 }, { "name": "nlpNounGroup", "term": "invigorating autumn", "startOffset": 164, "endOffset": 182 }, { "name": "nlpNounGroup", "term": "rude awakening", "startOffset": 357, "endOffset": 370 }, { "name": "nlpPlace", "term": "America", "startOffset": 466, "endOffset": 472 }, { "name": "nlpNounGroup", "term": "citizenship rights", "startOffset": 505, "endOffset": 522 }, { "name": "nlpNounGroup", "term": "bright day", "startOffset": 613, "endOffset": 622 } ] }

    application/vnd.sas.text.concepts.concept+json

    The application/vnd.sas.text.concepts.concept media type represents a concept for a matched document. The vnd.sas.text.concepts.concept.result media type contains a collection of these.

    This is described by concept.

    { "name": "nlpNounGroup", "term": "sweltering summer", "startOffset": 77, "endOffset": 93 }

    application/vnd.sas.text.concepts.fact.result

    The vnd.sas.text.concepts.fact.result media type represents the facts of a specific document, regardless of whether the document came from an input table or was uploaded directly into the job.

    This is described by factResult.

    { "version": 1, "id": "05.txt", "facts": [ { "name": "VERBS", "term": "is", "startOffset": 515, "endOffset": 516, "arguments": [ { "name": "verb", "matchedText": "is" } ] } ] }

    application/vnd.sas.text.concepts.fact

    The application/vnd.sas.text.concepts.fact media type represents a fact for a matched document. The vnd.sas.text.concepts.fact.result media type contains a collection of these.

    This is described by fact.

    { "name": "VERBS", "term": "is", "startOffset": 515, "endOffset": 516, "arguments": [ { "name": "verb", "matchedText": "is" } ] }

    application/vnd.sas.text.concepts.fact.argument

    The application/vnd.sas.text.concepts.fact.argument media type represents an argument for a fact. The vnd.sas.text.concepts.fact media type contains a collection of these.

    This is described by argument.

    { "name": "verb", "matchedText": "is" }

    application/vnd.sas.api

    Contains top-level links for an API. See application/vnd.sas.api.

    application/vnd.sas.collection

    A paginated, filterable, sortable collection of resource representations. See application/vnd.sas.collection.

    application/vnd.sas.error

    A detailed description of an error. See application/vnd.sas.error.

    application/vnd.sas.compute.log.line

    A single line from a log file. For this service, the log is created by the execution of a job. See application/vnd.sas.compute.log.line.

    Error Codes

    HTTP Status Code Error Code Description
    400 71205 The request was invalid. The specified state value is not a valid state.
    400 71206 The request was invalid. The specified state value is not a valid state. Only the state 'canceled' is permitted.
    400 71212 The specified paging parameters (start or limit) are invalid.
    404 70700 No fact results exist at the requested path. Fact results are not available, because they were not enabled for the given job.
    404 71200 The specified job ID does not exist at the requested path.
    404 71202 Results are not available yet because the job has not finished execution.
    404 71203 Results are not available because the job was canceled.
    404 71204 Results are not available because the job failed. If available, you can find more information from the /errors endpoint.
    404 71210 No CAS library exists at the requested path. The specified CAS library is invalid.
    404 71211 The specified URI does not exist at the requested path.
    409 71201 The request could not be completed due to a conflict with the current state of the job. The job must be canceled before you can delete it.
    409 71207 The request could not be completed due to a conflict with the current state of the job. The job cannot be canceled because it has already completed.
    500 71208 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was fetching results.
    500 71209 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was storing the specified data.

    Text Parsing

    Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

    The Text Parsing API parses natural language text documents.

    Base URLs:

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/ \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.api+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.api+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.api+json'
    }
    
    r = requests.get('https://www.example.com/parsing/', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /

    Returns a list of top-level resource links in this API.

    Example responses

    200

    {
      "version": 1,
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    
    Status Meaning Description Schema
    200 OK The request succeeded. The request returned a collection of link objects. Inline

    Check API availability

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/parsing/
    
    
    
    $.ajax({
      url: 'https://www.example.com/parsing/',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/parsing/', params={
    
    )
    
    print r.json()
    
    

    HEAD /

    Retrieves header information for the API resource. You can also use the request to check whether the service is available.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. API resource links are available. None

    Get a collection of jobs

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/jobs \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/parsing/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs

    Returns a collection of jobs that the server has processed or is currently processing for the current user. If no such jobs exist, an empty collection is returned.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering the collection. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting the collection. See Sorting in REST APIs.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "description": "string",
          "language": "ar",
          "includeStandardEntities": false,
          "includeNounGroups": true,
          "startListUri": "string",
          "stopListUri": "string",
          "synonymListUri": "string",
          "minimumDocumentCount": 0,
          "conceptModelUri": "string",
          "outputTableNamePostfix": "string",
          "enableSpellChecking": false,
          "overrideListUri": "string",
          "inputUri": "string",
          "documentIdVariable": "string",
          "textVariable": "string",
          "version": 0,
          "id": "string",
          "state": "pending",
          "creationTimeStamp": "2019-02-20T19:58:17Z"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The request returns all of the current jobs for a given user. parsingJobs

    Check whether a collection of jobs exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/parsing/jobs
    
    
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/parsing/jobs', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs

    Retrieves header information for a collection of jobs. You can also use this request to check whether a collection exists.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false Indicates the criteria for filtering a collection. See Filtering in REST APIs.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    sortBy query string(sort-criteria) false Indicates the criteria for sorting a collection. See Sorting in REST APIs.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The collection is available. None

    Create a job that parses a table of documents

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/parsing/jobs \
      -H 'Content-Type: application/vnd.sas.text.parsing.job.request+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.parsing.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.parsing.job.request+json',
      'Accept':'application/vnd.sas.text.parsing.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.parsing.job.request+json',
      'Accept': 'application/vnd.sas.text.parsing.job+json'
    }
    
    r = requests.post('https://www.example.com/parsing/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs

    Performs natural language parsing on the input data.

    Body parameter

    {
      "description": "string",
      "language": "ar",
      "includeStandardEntities": false,
      "includeNounGroups": true,
      "startListUri": "string",
      "stopListUri": "string",
      "synonymListUri": "string",
      "minimumDocumentCount": 0,
      "conceptModelUri": "string",
      "outputTableNamePostfix": "string",
      "enableSpellChecking": false,
      "overrideListUri": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string"
    }
    

    Parameters

    Parameter In Type Required Description
    body body parsingJobRequest true Indicates the text to parse.

    Example responses

    202

    {
      "description": "string",
      "language": "ar",
      "includeStandardEntities": false,
      "includeNounGroups": true,
      "startListUri": "string",
      "stopListUri": "string",
      "synonymListUri": "string",
      "minimumDocumentCount": 0,
      "conceptModelUri": "string",
      "outputTableNamePostfix": "string",
      "enableSpellChecking": false,
      "overrideListUri": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:17Z"
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted Indicates that the job was accepted for processing, but the processing has not been completed. parsingJob
    400 Bad Request The request was invalid. Both a start list and a stop list were specified. You cannot use both simultaneously. error2

    Create a job to parse documents in the request

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/parsing/jobs#data \
      -H 'Content-Type: application/vnd.sas.text.parsing.job.request.documents+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.parsing.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.parsing.job.request.documents+json',
      'Accept':'application/vnd.sas.text.parsing.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs#data',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.parsing.job.request.documents+json',
      'Accept': 'application/vnd.sas.text.parsing.job+json'
    }
    
    r = requests.post('https://www.example.com/parsing/jobs#data', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs#data

    Performs natural language parsing on the input data.

    Body parameter

    {
      "description": "string",
      "language": "ar",
      "includeStandardEntities": false,
      "includeNounGroups": true,
      "startListUri": "string",
      "stopListUri": "string",
      "synonymListUri": "string",
      "minimumDocumentCount": 0,
      "conceptModelUri": "string",
      "outputTableNamePostfix": "string",
      "enableSpellChecking": false,
      "overrideListUri": "string",
      "caslibUri": "string",
      "documents": [
        "string"
      ]
    }
    

    Parameters

    Parameter In Type Required Description
    body body parsingJobRequestDocuments true Indicates the documents to parse.

    Example responses

    202

    {
      "description": "string",
      "language": "ar",
      "includeStandardEntities": false,
      "includeNounGroups": true,
      "startListUri": "string",
      "stopListUri": "string",
      "synonymListUri": "string",
      "minimumDocumentCount": 0,
      "conceptModelUri": "string",
      "outputTableNamePostfix": "string",
      "enableSpellChecking": false,
      "overrideListUri": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:17Z"
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted The request has been accepted for processing, but the processing has not been completed. parsingJob
    400 Bad Request The request was invalid. Both a start list and a stop list were specified. You cannot use both simultaneously. error2

    Get job information for a specific job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.parsing.job+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.text.parsing.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.text.parsing.job+json'
    }
    
    r = requests.get('https://www.example.com/parsing/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}

    Returns the current information for a job that was submitted to the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    200

    {
      "description": "string",
      "language": "ar",
      "includeStandardEntities": false,
      "includeNounGroups": true,
      "startListUri": "string",
      "stopListUri": "string",
      "synonymListUri": "string",
      "minimumDocumentCount": 0,
      "conceptModelUri": "string",
      "outputTableNamePostfix": "string",
      "enableSpellChecking": false,
      "overrideListUri": "string",
      "inputUri": "string",
      "documentIdVariable": "string",
      "textVariable": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:17Z"
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The information about the job is available. parsingJob
    404 Not Found The specified job ID does not exist at the requested path. error2

    Check whether a job exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/parsing/jobs/{jobId}
    
    
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/parsing/jobs/{jobId}', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}

    Retrieves header information for the job. You can also use this request to check whether the job exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The specified ID exists. None
    404 Not Found The specified job ID does not exist at the requested path. None

    Delete the specified job from the server

    Code samples

    # You can also use wget
    curl -X DELETE https://www.example.com/parsing/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: */*'
    
    
    var headers = {
      'Accept':'*/*'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}',
      method: 'delete',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': '*/*'
    }
    
    r = requests.delete('https://www.example.com/parsing/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    DELETE /jobs/{jobId}

    Deletes the job that is identified by its job ID. If the job has not yet completed, the operation is canceled. The parse data and any output is then cleared from the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job to look up.

    Example responses

    404

    Responses

    Status Meaning Description Schema
    204 No Content The job was deleted. None
    404 Not Found The specified job ID does not exist at the requested path. error2

    Get the state of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/jobs/{jobId}/state \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/state',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/parsing/jobs/{jobId}/state', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/state

    Gets the state of an existing job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current job state is available. taskState
    404 Not Found The specified job ID does not exist at the requested path. error2

    Check whether the state of a job exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/parsing/jobs/{jobId}/state
    
    
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/state',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/parsing/jobs/{jobId}/state', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/state

    Retrieves header information for the state of a job. You can also use this request to check whether the state exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The specified ID was found. None
    404 Not Found The specified job ID does not exist at the requested path. None

    Modify the state of an existing job

    Code samples

    # You can also use wget
    curl -X PUT https://www.example.com/parsing/jobs/{jobId}/state?value=canceled \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/state',
      method: 'put',
      data: '?value=canceled',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.put('https://www.example.com/parsing/jobs/{jobId}/state', params={
      'value': 'canceled'
    }, headers = headers)
    
    print r.json()
    
    

    PUT /jobs/{jobId}/state

    Modifies the state of an existing job. Currently, use this request only to cancel the job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    value query string true Indicates the value to change the state to for a job.

    Enumerated Values

    Parameter Value
    value canceled

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The state was successfully updated. The response contains the updated state. taskState
    400 Bad Request The request was invalid. The specified state value is not a valid state. error2
    404 Not Found The specified job ID does not exist at the requested path. error2

    Get the results of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/jobs/{jobId}/results \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/results',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/parsing/jobs/{jobId}/results', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/results

    Retrieves the results of a job. This endpoint is available only when the state of the job is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job from which you want results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    includeDroppedTerms query boolean false Indicates a Boolean that specifies whether to include dropped terms in the results. The default value is false.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "id": "string",
          "terms": [
            {
              "value": "string",
              "role": "string",
              "startOffset": 0,
              "endOffset": 0,
              "kept": true
            }
          ],
          "version": 0
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The job result is available. parsingJobResults
    404 Not Found No result exists at the requested path. If available, you can find more information through the /jobs/{jobId} endpoint. error2

    Check whether the results of a job exist

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/parsing/jobs/{jobId}/results
    
    
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/results',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/parsing/jobs/{jobId}/results', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/results

    Retrieves header information for the results of a job. You can also use this request to check whether the results exist. This endpoint is available only when the state of the job is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job from which you want results.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.
    includeDroppedTerms query boolean false Indicates a Boolean that specifies whether to include dropped terms in the results. The default value is false.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The result is available. None
    404 Not Found No result exists at the requested path. If available, you can find more information through the /jobs/{jobId} endpoint. None

    Get job errors

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/jobs/{jobId}/errors \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.error+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.error+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/errors',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.error+json'
    }
    
    r = requests.get('https://www.example.com/parsing/jobs/{jobId}/errors', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/errors

    Gets any errors that were generated as a result of a job. The response might contain multiple errors via the nested errors array member. This endpoint is available only when the job state is failed. The best access point is the errors link from the job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    200

    {
      "message": "string",
      "id": "string",
      "errorCode": 0,
      "httpStatusCode": 0,
      "details": [
        "string"
      ],
      "remediation": "string",
      "errors": [
        null
      ],
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. All of the job errors are available. error2
    204 No Content There is no content for this job. The job ID was found, and there are no errors. None
    404 Not Found The specified job ID does not exist at the requested path. error2

    Check whether errors exist for a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/parsing/jobs/{jobId}/errors
    
    
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/errors',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/parsing/jobs/{jobId}/errors', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/errors

    Retrieves header information for job errors. You can also use this request to check whether job errors exist.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Errors are available. None
    404 Not Found No errors exist at the requested path. None

    Get the log for a job as plain text

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/jobs/{jobId}/log \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/log',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/parsing/jobs/{jobId}/log', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log

    Gets the plain text log from a job.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log is available. string
    404 Not Found The specified job ID does not exist at the requested path. error2

    Check whether the log for a job exists

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/parsing/jobs/{jobId}/log
    
    
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/log',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/parsing/jobs/{jobId}/log', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/log

    Retrieves header information for the job log. You can also use this request to check whether the job log exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log is available. None
    404 Not Found No log exists at the requested path. None

    Get the log for a job as a collection of log lines

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/parsing/jobs/{jobId}/log#collection \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/parsing/jobs/{jobId}/log#collection',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/parsing/jobs/{jobId}/log#collection', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log#collection

    Gets the log from a job formatted as a collection of application/vnd.sas.compute.log.line objects.

    Parameters

    Parameter In Type Required Description
    jobId path string true Indicates the ID of the job.
    start query integer(int64) false Indicates the start index for pagination.
    limit query integer(int32) false Indicates the limit parameter for pagination.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "version": 1,
          "type": "normal",
          "line": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The log is available. logLineCollection
    404 Not Found The specified job ID does not exist at the requested path. error2

    Schemas

    taskState

    Properties

    Job State

    Name Type Required Description
    Job State string false Indicates the state of the job.
    Enumerated Values
    Property Value
    Job State pending
    Job State running
    Job State completed
    Job State canceled
    Job State failed

    language

    Properties

    Language

    Name Type Required Description
    Language string false Indicates the two letter ISO 639-1 value for a language.
    Enumerated Values
    Property Value
    Language ar
    Language cs
    Language da
    Language de
    Language el
    Language en
    Language es
    Language fa
    Language fi
    Language fr
    Language he
    Language hi
    Language hr
    Language hu
    Language id
    Language it
    Language ja
    Language ko
    Language nl
    Language no
    Language pl
    Language pt
    Language ro
    Language ru
    Language sk
    Language sl
    Language sv
    Language th
    Language tl
    Language tr
    Language vi
    Language zh

    baseParsingJobRequest

    Properties

    Common Job Request Properties

    Name Type Required Description
    description string false Indicates a brief description with details about a job.
    language language true Indicates the language of the input data.
    includeStandardEntities boolean false Indicates a flag that specifies whether to include standard entities in the result.
    includeNounGroups boolean false Indicates a flag that specifies whether to include noun groups in the result.
    startListUri string false Indicates the URI to a table that contains terms to keep. Do not use a start list and a stop list simultaneously.
    stopListUri string false Indicates the URI to a table that contains terms to drop. Do not use a stop list and a start list simultaneously.
    synonymListUri string false Indicates the URI to a table that contains synonyms.
    minimumDocumentCount integer(int32) false Indicates the minimum number of documents that a term must appear in to be kept. The default value is 10.
    conceptModelUri string false Indicates the URI to a table that contains the concept LITI binaries to apply during parsing.
    outputTableNamePostfix string false Indicates text to add to the end of the output table names. If left blank, the server generates text.
    enableSpellChecking boolean false A flag indicating whether or not spell checking should be performed while parsing.
    overrideListUri string false The URI to a table that contains overrides for keep and drop terms.

    parsingJobRequest

    Properties

    Job Request for a Table

    Name Type Required Description
    Job Request for a Table any false Indicates a request to create a text parsing job from a table. This is the application/vnd.sas.text.parsing.job.request media type.

    allOf

    Name Type Required Description
    anonymous baseParsingJobRequest false Indicates the common properties that can be specified for a job request.

    and

    Name Type Required Description
    anonymous object false
    » inputUri string true Indicates the URI to the table that contains the documents to parse.
    » documentIdVariable string true Indicates the name of the variable in the table that contains the document ID.
    » textVariable string true Indicates the name of the variable in the table that contains the document text.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    parsingJobRequestDocuments

    Properties

    Job Request for Documents in the Request

    Name Type Required Description
    Job Request for Documents in the Request any false Indicates a request to create a parsing job from inline documents. This is the application/vnd.sas.text.parsing.job.request.documents media type.

    allOf

    Name Type Required Description
    anonymous baseParsingJobRequest false Indicates the common properties that can be specified for a job request.

    and

    Name Type Required Description
    anonymous object false
    » caslibUri string true Indicates the URI to a caslib in which data is stored.
    » documents [string] true Indicates the text documents to parse. These documents are identified in the order in which they are specified to the API, starting from 1 and proceeding sequentially.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    parsingJob

    Properties

    Parsing Job

    Name Type Required Description
    Parsing Job any false Indicates a parsing job. This is the application/vnd.sas.text.parsing.job media type.

    allOf

    Name Type Required Description
    anonymous parsingJobRequest false Indicates a request to create a text parsing job from a table. This is the application/vnd.sas.text.parsing.job.request media type.

    and

    Name Type Required Description
    anonymous object false
    » id string true Indicates the server-generated ID that uniquely defines a parse.
    » state taskState true Indicates the current state of a parse.
    » creationTimeStamp string(date-time) true Indicates a string that contains the datetime value when a job was created in format yyyy-mm-ddThh:mm:ssZ.
    » version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    parsingJobResults

    Properties

    Collection of Parsed Documents

    Name Type Required Description
    Collection of Parsed Documents any false Indicates the output payload that represents the results of parsing.

    allOf

    Name Type Required Description
    anonymous object false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)
    » name string false The name of the collection.
    » start integer(int64) false The zero-based index of the first item in the collection.
    » limit integer false The number of items that were requested for the collection.
    » count integer(int64) false The number of items in the collection.
    » accept string false A space-delimited list of media types from which an Accept header may be constructed.
    » links [any] false The links that apply to the collection.
    »» Link object false A link to a related operation or resource.
    »»» method string false The HTTP method for the link.
    »»» rel string true The relationship of the link to the resource.
    »»» uri string false The relative URI for the link.
    »»» href string false The URL for the link.
    »»» title string false The title for the link.
    »»» type string false The media type or link type for the link.
    »»» itemType string false If this is a link to a container, itemType is the media type or link type for the items in the container.
    »»» responseType string false The media type or link type of the response body for a PUT, POST, or PATCH operation.
    »»» responseItemType string false The media type or link type of the items in the response body for a PUT, POST, or PATCH operation.
    »» version integer false The version number of the collection representation. This representation is version 2.

    and

    Name Type Required Description
    » anonymous object false
    »» items [parsingJobResult] true Indicates the collection of results. Each entry corresponds to results for one input document. Results are linked to input documents by the id field.

    parsingJobResult

    Properties

    Parsing Result

    Name Type Required Description
    id string true Indicates the document identifier. This field links the input document to its result. If a table is specified, then this value corresponds to the documentIdVariable value. If documents are specified directly to the API, then this value corresponds to the order in which the documents were specified. The first document receives an ID value of 1, the second 2, and so on.
    terms [term] true Indicates the text terms that were parsed from the input document.
    version integer(int32) true Indicates the schema version number of a media type. This instance is version 1.

    term

    Properties

    Term

    Name Type Required Description
    value string true Indicates the text content of this term.
    role string true Indicates the role (part of speech) for a term that was identified in the original document.
    startOffset integer(int32) true Indicates the index where a term begins relative to the original document.
    endOffset integer(int32) true Indicates the index where a term ends relative to the original document.
    kept boolean true Indicates a flag that specifies whether a term was kept.

    parsingJobs

    Properties

    Collection of Parses

    Name Type Required Description
    Collection of Parses any false

    allOf

    Name Type Required Description
    anonymous parsingJobResults/allOf/0 false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [parsingJob] false Array containing parses.

    logLineCollection

    Properties

    Collection of Log Lines

    Name Type Required Description
    Collection of Log Lines any false Indicates a collection of lines from the log file.

    allOf

    Name Type Required Description
    anonymous parsingJobResults/allOf/0 false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [any] true
    »» Log Line object false A single line in a log. This is the application/vnd.sas.compute.log.line media type.
    »»» version integer(int32) true The version number of the Log Line (logLine) representation. This is version 1.
    »»» type string true The line entry classification.
    »»» line string true The line of text without the type (classification) prefix marker.
    Enumerated Values
    Property Value
    type normal
    type highlighted
    type source
    type title
    type byline
    type footnote
    type error
    type warning
    type note
    type message

    error2

    Properties

    Error

    Name Type Required Description
    message string false The message for the error.
    id string false The string ID for the error.
    errorCode integer false The numeric ID for the error.
    httpStatusCode integer true The HTTP status code for the error.
    details [string] false Messages that provide additional details about the cause of the error.
    remediation string false A message that describes how to resolve the error.
    errors [error2] false Any additional errors that occurred.
    links [parsingJobResults/allOf/0/properties/links/items] false The links that apply to the error.
    version integer true The version number of the error representation. This representation is version 2.

    Usage Notes

    Overview

    Parsing is a key operation in understanding your data. Parsing a document involves the following analyses:

    The output tables that are generated during parsing can also be used in downstream analyses such as topic generation.

    This service provides two different interactions for parsing: parsing documents in CAS tables and parsing documents that are uploaded directly into the API. In both cases, the service uses an asynchronous execution model. The client creates an analysis job that runs in the background after the Create operation returns. The API provides resource endpoints for checking the state of the job. Then, when it is complete, you retrieve the results by using either the /results endpoint on the job or by interacting with the result table directly. To interact with the results table directly you use another API, such as the Row Sets API.

    When parsing documents in a table, the service views each row in the input table as a document. Thus, the API requires two input parameters: documentIdVariable and textVariable. The documentIdVariable is a unique identifier for the document and the textVariable is the actual document text. For example, consider a table containing tweets from @SASSoftware:

    ID Date Created Message
    850007368138018817 Thu Apr 06 15:28:43 +0000 2017 Real-time and #AI are changing marketing: join 9/13 #SASWebinar with special guest from @Forrester
    787452347508998458 Thu Apr 06 12:54:02 +0000 2017 US has over 4 million miles of roads that could have 10 million fully or semi autonomous cars by 2020 #IoT
    774598598680208850 Thu Apr 06 12:28:22 +0000 2017 Need help with your fight against #fraud?

    In this example, the documentIdVariable would be ID and the textVariable would be Message.

    One of the values the API takes as input is a language parameter. For English, the language parameter must take the form of en (ISO-639-1 short codes for English). The language parameter is used to select the linguistic binaries that are used to parse documents.

    The API also takes optional startListUri, stopListUri, and synonymListUri input table URIs. If neither a startListUri nor stopListUri is provided and the specified language has an associated default stop list, then this stop list is used. Only one of these two tables can be provided for a single job. See Start List, Stop List, and Synonym List for more information.

    Terminology

    binary

    a rule that identifies a language-specific construct, such as a part of speech or an entity. The binaries for a language comprise the model that determines which types of terms a document contains.

    job

    a container for an asynchronous operation. A job supports a number of different operations such as checking a state, canceling an operation, fetching results, and so on. All jobs are performed asynchronously.

    language

    a parameter that specifies which domain-independent model to use for processing input documents. This parameter is required when you process tables or uploaded documents. For English, the language parameter must take the form of "en" (see ISO-639-1 short codes).

    library

    a container for inputs and outputs when you use CAS. Services, such as parsing, use a library to locate input data and to store output tables that they create.

    LITI binary model

    a compiled binary model for extracting concepts or facts from a document. The language interpretation and text interpretation (LITI) binary model is built using a tool such as SAS Enterprise Content Categorization (ECC), SAS Contextual Analysis (SCA), or SAS Visual Text Analytics (VTA). LITI is the programming language that is used to define concepts and fact rules. LITI binary models are stored in *.li files.

    parse

    an operation that is performed on a document or a collection of documents, such as in a table. A parse operation identifies terms, entities, and parts of speech. Other operations, such as resolving synonyms, misspellings, and so on, can also be performed by a parse operation.

    start list

    a table of terms to keep in the output. Any terms that are not included in the start list are dropped. A start list must contain a term column and can contain an optional role column. You cannot use a start list in conjunction with a stop list.

    stop list

    a table of terms to drop from the output. A stop list must contain a term column and can contain an optional role column. You cannot use a stop list in conjunction with a start list.

    synonym list

    a table that is used to map child terms to parent terms. A synonym list must contain two columns, term and parent. A synonym list can contain the optional columns term_role and parent_role.

    override list

    a table that can be used to force terms to be kept or dropped regardless of other processing.

    table

    the input to and output from a parsing job. The input table must have both an ID column (documentIdVariable) and a column that contains text data (textVariable). A table can contain other columns as well. Output tables are generated by a parsing job.

    term

    a specific word or phrase in a document. A term typically has an associated role that identifies the function of the term. A term's role might be to function as a part of speech or to function as an entity, such as person. A term also contains offset information (startOffset and endOffset) that identifies the location of the term within a document.

    Resources

    Resource Relationships

    The diagram below shows the relationships between the resources in this API.

    Parsing entity relationship diagram

    Root

    Path: /

    The root of the API. This resource contains links to the top-level resources in the API. The response uses the application/vnd.sas.api media type.

    The GET / response includes these links.

    Relation Method Description
    jobs GET Returns the first page of the collection of jobs.
    URI: /jobs
    Response type: application/vnd.sas.collection
    Response item type: application/vnd.sas.text.parsing.job
    startParsing POST Submits a new parsing job for execution.
    URI: /jobs
    Request type: application/vnd.sas.text.parsing.job.request or application/vnd.sas.text.parsing.job.request.documents.
    Response type: application/vnd.sas.text.parsing.job

    Jobs

    Path: /jobs

    This API provides collections of jobs. Members of the /jobs collection are job resources, /job/{jobId}. (See below.)

    The GET operation on this path returns a application/vnd.sas.collection. This collection response includes these links.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without the sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page of the collection.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    Sorting and Filtering

    This collection can be sorted and filtered by using the ?sortBy= and ?filter= query parameters.

    Filtering and sorting uses these members of the Job resource:

    Job

    Path: /jobs/{jobId}

    A specific job resource.

    A job resource has these link relations in the appication/vnd.sas.text.parsing.job representation:

    Relation Method Description
    self GET Gets the job itself.
    URI: /jobs/{jobId}
    Response type: application/vnd.sas.text.parsing.job
    delete DELETE Deletes the job.
    URI: /jobs/{jobId}
    state GET Gets the job state.
    URI: /jobs/{jobId}/state
    Response type: text/plain
    cancel PUT Cancels the job.1
    URI: /jobs/{jobId}/state?value=canceled
    results GET Gets the job results.2
    URI: /jobs/{jobId}/results
    Response type: application/vnd.sas.text.parsing.job.results
    errors GET Gets any errors associated with the job.3
    URI: /jobs/{jobId}/errors
    Response type: application/vnd.sas.error
    log GET Gets the log associated with the job.
    URI: /jobs/{jobId}/log
    Response type: text/plain or application/json
    caslib GET Gets the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib

    1 - Only available when this job's state is 'pending' or 'running'.
    2 - Only available when this job's state is 'completed'.
    3 - Only available when this job's state is 'failed' or 'canceled'.

    Job Results

    Path: /jobs/{jobId}/results

    The result from parsing for a specific job. This path returns a collection of application.vnd.sas.parsing.job.result objects.

    The GET operation on this path returns an application/vnd.sas.collection. This collection response includes these links.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection, without the sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection.
    This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection.
    This link is omitted if the current view is on the last page of the collection.
    first GET Returns the first page of resources from the collection.
    This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection.
    This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    caslib GET Gets the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib
    positionTable GET Gets the backing position table for the results
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    parentTable GET Gets the backing parent table for the results
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    childrenTable GET Gets the backing children table for the results
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    termsTable GET Gets the backing terms table for the results
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    configurationTable GET Gets the backing configuration table for the results
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    svdTable GET Gets the backing SVD table for the results
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table

    Media Types

    application/vnd.sas.text.parsing.job.request+json

    The application/vnd.sas.text.parsing.job.request media type represents a request to start a text parsing job that processes a table as input.

    This is described by parsingJobRequest.

    { "description": "My table request", "language": "en", "includeStandardEntities": false, "includeNounGroups": true, "startListlUri": "/casManagement/servers/cas/caslibs/lib/tables/startList", "stopListlUri": "/casManagement/servers/cas/caslibs/lib/tables/stopList", "synonymListlUri": "/casManagement/servers/cas/caslibs/lib/tables/synonymList", "minimumDocumentCount": 10, "conceptModellUri": "/casManagement/servers/cas/caslibs/lib/tables/conceptModel", "outputTableNamePostfix": "-TMP", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/input", "documentIdVariable": "id", "textVariable": "text", "enableSpellChecking": false, "overrideListUri": "/casManagement/servers/cas/caslibs/lib/tables/overrideList" }

    application/vnd.sas.text.parsing.job.request.documents+json

    The application/vnd.sas.text.parsing.job.request.documents media type represents a request to start a text parsing job that processes the documents that are provided in the request payload.

    This is described by parsingJobRequestDocuments.

    { "description": "My inline document request", "language": "en", "includeStandardEntities": false, "includeNounGroups": true, "startListlUri": "/casManagement/servers/cas/caslibs/lib/tables/startList", "stopListlUri": "/casManagement/servers/cas/caslibs/lib/tables/stopList", "synonymListlUri": "/casManagement/servers/cas/caslibs/lib/tables/synonymList", "minimumDocumentCount": 10, "conceptModellUri": "/casManagement/servers/cas/caslibs/lib/tables/conceptModel", "outputTableNamePostfix": "-TMP", "caslibUri": "/casManagement/servers/cas/caslibs/lib", "documents": ["This text to parse.", "This additional document to parse."], "enableSpellChecking": false, "overrideListUri": "/casManagement/servers/cas/caslibs/lib/tables/overrideList" }

    application/vnd.sas.text.parsing.job+json

    The application/vnd.sas.text.parsing.job media type represents a job that is created to parse natural language text. Make the job process a CAS table by using the application/vnd.sas.text.parsing.job.request media type, or make the job process documents that are loaded directly to the service by using the application/vnd.sas.text.parsing.job.request.documents media type.

    This is described by parsingJob.

    { "version": 2, "language": "en", "includeStandardEntities": false, "includeNounGroups": true, "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/input", "documentIdVariable": "id", "textVariable": "reviewbody", "enableSpellChecking": false, "id": "f0250e89-5475-4de5-bddf-1f78b3a3a4f9", "state": "completed", "creationTimeStamp": "2017-09-08T19:26:42.472Z", "links": [ { "method": "GET", "rel": "self", "href": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9", "uri": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9", "type": "application/vnd.sas.text.parsing.job" }, { "method": "DELETE", "rel": "delete", "href": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9", "uri": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9" }, { "method": "GET", "rel": "state", "href": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9/state", "uri": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9/state", "type": "text/plain" }, { "method": "GET", "rel": "log", "href": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9/log", "uri": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9/log", "type": "text/plain" }, { "method": "GET", "rel": "results", "href": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9/results", "uri": "/parsing/jobs/f0250e89-5475-4de5-bddf-1f78b3a3a4f9/results", "type": "application/vnd.sas.collection", "itemType": "application/vnd.sas.text.parsing.job.result" }, { "method": "GET", "rel": "caslib", "href": "/casManagement/servers/cas/caslibs/lib", "uri": "/casManagement/servers/cas/caslibs/lib", "type": "application/vnd.sas.cas.caslib" } ] }

    application/vnd.sas.text.parsing.job.result+json

    The application/vnd.sas.text.parsing.job.result media type represents a parsed document. The document might have come from a table, or the document might have been uploaded directly into the service, depending on how you generated the results. The only property of interest in the result is the terms collection, which is a collection of application/vnd.sas.text.parsing.term objects.

    This is described by parsingJobResult.

    { "version": 1, "id": "r1", "terms": [ { "value": "very", "role": "ADV", "startOffset": 92, "endOffset": 95, "kept": true }, { "value": "refurbished", "role": "V", "startOffset": 12, "endOffset": 22, "kept": true }, { "value": "input", "role": "PN", "startOffset": 29, "endOffset": 34, "kept": true }, { "value": "price", "role": "N", "startOffset": 117, "endOffset": 121, "kept": true }, { "value": "price", "role": "N", "startOffset": 117, "endOffset": 121, "kept": true }, { "value": "works", "role": "V", "startOffset": 75, "endOffset": 79, "kept": true }, { "value": "perfectly", "role": "ADV", "startOffset": 81, "endOffset": 89, "kept": true }, { "value": "good", "role": "A", "startOffset": 97, "endOffset": 100, "kept": true }, { "value": "good", "role": "A", "startOffset": 97, "endOffset": 100, "kept": true }, { "value": "brand new", "role": "A", "startOffset": 61, "endOffset": 69, "kept": true }, { "value": "bought", "role": "V", "startOffset": 2, "endOffset": 7, "kept": true }, { "value": "system", "role": "N", "startOffset": 51, "endOffset": 56, "kept": true }, { "value": "system", "role": "N", "startOffset": 102, "endOffset": 107, "kept": true }, { "value": "system", "role": "N", "startOffset": 51, "endOffset": 56, "kept": true }, { "value": "system", "role": "N", "startOffset": 102, "endOffset": 107, "kept": true } ] }

    application/vnd.sas.text.parsing.term+json

    The application/vnd.sas.text.parsing.term media type represents a term that is found in a document. A term typically contains role information and the starting and ending offsets that are used to locate the term within the document text.

    This is described by term.

    { "value": "system", "role": "N", "startOffset": 102, "endOffset": 107, "kept": true }

    application/vnd.sas.api

    Contains top-level links for an API. See application/vnd.sas.api.

    application/vnd.sas.collection

    Contains a paginated, filterable, sortable collection of resource representations. See application/vnd.sas.collection.

    application/vnd.sas.error

    Contains a detailed description of an error. See application/vnd.sas.error.

    application/vnd.sas.compute.log.line

    Contains a single line from a log file. For this service, the log is generated from the execution of a job. See application/vnd.sas.compute.log.line.

    Error Codes

    HTTP Status Code Error Code Description
    400 70800 The request was invalid. Both a start list and a stop list were specified. You cannot use both simultaneously.
    400 71205 The request was invalid. The specified state value is not a valid state.
    400 71206 The request was invalid. The specified state value is not a valid state. Only the state ‘canceled’ is permitted.
    400 71212 The specified paging parameters (start or limit) are invalid.
    404 70801 The specified start list or stop list does not exist at the requested path.
    404 71200 The specified job ID does not exist at the requested path.
    404 71202 Results are not available yet because the job has not finished execution.
    404 71203 Results are not available because the job was canceled.
    404 71204 Results are not available because the job failed. If available, you can find more information from the /errors endpoint.
    404 71210 No CAS library exists at the requested path. The specified CAS library is invalid.
    404 71211 The specified URI does not exist at the requested path.
    409 71201 The request could not be completed due to a conflict with the current state of the job. The job must be canceled before you can delete it.
    409 71207 The request could not be completed due to a conflict with the current state of the job. The job cannot be canceled because it has already completed.
    500 71208 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was fetching results.
    500 71209 The request could not be fulfilled because of an unexpected server error. An error occurred while the request was storing the specified data.

    Topics

    Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

    The Topics API creates topics (statistically generated categories) from text documents using the output of the Text Parsing API.

    Base URLs:

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/ \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.api+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.api+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.api+json'
    }
    
    r = requests.get('https://www.example.com/topics/', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /

    Returns a list of links to the top-level resources in this API.

    Example responses

    200

    {
      "version": 1,
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ]
    }
    
    Status Meaning Description Schema
    200 OK The request succeeded. The collection of link objects is available. Inline

    Get headers for the API

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/topics/
    
    
    
    $.ajax({
      url: 'https://www.example.com/topics/',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/topics/', params={
    
    )
    
    print r.json()
    
    

    HEAD /

    Retrieves headers for the API. It can also be used to check whether the service that the API provides is available.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The API links are available. None

    Get a list of jobs

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/jobs \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/topics/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs

    Returns a collection of jobs that the server has processed or is currently processing for the current user. If no such jobs exist, it returns an empty collection.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false The criteria for filtering the collection. See Filtering in REST APIs.
    start query integer(int64) false The index of the first page to return.
    limit query integer(int32) false The maximum number of pages to return.
    sortBy query string(sort-criteria) false The criteria for sorting the collection. See Sorting in REST APIs.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "description": "string",
          "parentUri": "string",
          "parentTermIdVariable": "_TERMNUM_",
          "parentDocumentIdVariable": "_DOCUMENT_",
          "termsUri": "string",
          "topicCount": 1,
          "maximumTopicCount": 2,
          "termDensityMultiple": 0,
          "documentDensityMultiple": 0,
          "outputTableNamePostfix": "string",
          "configurationUri": "string",
          "version": 0,
          "id": "string",
          "state": "pending",
          "creationTimeStamp": "2019-02-20T19:58:18Z"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. All current jobs are shown. jobCollection

    Get the headers for the collection of jobs

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/topics/jobs
    
    
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/topics/jobs', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs

    Retrieves the headers for the collection of jobs. It can also be used to check whether the collection exists.

    Parameters

    Parameter In Type Required Description
    filter query string(string) false The criteria for filtering the collection. See Filtering in REST APIs.
    start query integer(int64) false The index of the first page to return.
    limit query integer(int32) false The maximum number of pages to return.
    sortBy query string(sort-criteria) false The criteria for sorting the collection. See Sorting in REST APIs.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The collection is available. None

    Create a new job to extract topics from a table of documents

    Code samples

    # You can also use wget
    curl -X POST https://www.example.com/topics/jobs \
      -H 'Content-Type: application/vnd.sas.text.topics.job.request+json' \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.topics.job+json'
    
    
    var headers = {
      'Content-Type':'application/vnd.sas.text.topics.job.request+json',
      'Accept':'application/vnd.sas.text.topics.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs',
      method: 'post',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Content-Type': 'application/vnd.sas.text.topics.job.request+json',
      'Accept': 'application/vnd.sas.text.topics.job+json'
    }
    
    r = requests.post('https://www.example.com/topics/jobs', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    POST /jobs

    Extracts topics from the submitted data.

    Body parameter

    {
      "description": "string",
      "parentUri": "string",
      "parentTermIdVariable": "_TERMNUM_",
      "parentDocumentIdVariable": "_DOCUMENT_",
      "termsUri": "string",
      "topicCount": 1,
      "maximumTopicCount": 2,
      "termDensityMultiple": 0,
      "documentDensityMultiple": 0,
      "outputTableNamePostfix": "string",
      "configurationUri": "string"
    }
    

    Parameters

    Parameter In Type Required Description
    body body jobRequest true The text to analyze.

    Example responses

    202

    {
      "description": "string",
      "parentUri": "string",
      "parentTermIdVariable": "_TERMNUM_",
      "parentDocumentIdVariable": "_DOCUMENT_",
      "termsUri": "string",
      "topicCount": 1,
      "maximumTopicCount": 2,
      "termDensityMultiple": 0,
      "documentDensityMultiple": 0,
      "outputTableNamePostfix": "string",
      "configurationUri": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:18Z"
    }
    

    Responses

    Status Meaning Description Schema
    202 Accepted Accepted for processing. job
    400 Bad Request The request was not valid because the specified request payload was not valid. See the response for details. error2

    Get a specific job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.text.topics.job+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.text.topics.job+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.text.topics.job+json'
    }
    
    r = requests.get('https://www.example.com/topics/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}

    Returns current information about a job that was submitted to the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job to look up.

    Example responses

    200

    {
      "description": "string",
      "parentUri": "string",
      "parentTermIdVariable": "_TERMNUM_",
      "parentDocumentIdVariable": "_DOCUMENT_",
      "termsUri": "string",
      "topicCount": 1,
      "maximumTopicCount": 2,
      "termDensityMultiple": 0,
      "documentDensityMultiple": 0,
      "outputTableNamePostfix": "string",
      "configurationUri": "string",
      "version": 0,
      "id": "string",
      "state": "pending",
      "creationTimeStamp": "2019-02-20T19:58:18Z"
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Information about the job is available. job
    404 Not Found No results exist. The specified ID was not found. error2

    Get the headers for a specific job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/topics/jobs/{jobId}
    
    
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/topics/jobs/{jobId}', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}

    Retrieves the headers for a specific job. It can also be used to check whether the job exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job to look up.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Information about the job is available. None
    404 Not Found No results exist. The specified job ID was not found. None

    Delete the specified job from the server

    Code samples

    # You can also use wget
    curl -X DELETE https://www.example.com/topics/jobs/{jobId} \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: */*'
    
    
    var headers = {
      'Accept':'*/*'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}',
      method: 'delete',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': '*/*'
    }
    
    r = requests.delete('https://www.example.com/topics/jobs/{jobId}', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    DELETE /jobs/{jobId}

    Deletes the specified request by "id". If the job has not yet completed, the operation is canceled, and the job data and any output is cleared from the server.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job to look up.

    Example responses

    404

    Responses

    Status Meaning Description Schema
    204 No Content The job was successfully deleted. None
    404 Not Found No results exist. The specified job ID was not found. error2

    Get the job state

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/jobs/{jobId}/state \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/state',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/topics/jobs/{jobId}/state', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/state

    Retrieves the state of an existing job.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current job state is available. taskState
    404 Not Found No results exist. The specified job ID was not found. error2

    Get the headers for the state of a job

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/topics/jobs/{jobId}/state
    
    
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/state',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/topics/jobs/{jobId}/state', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/state

    Retrieves the headers for the state of an existing job. It can also be used to check whether the state exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The current job state is available. None
    404 Not Found No results exist. The specified job ID was not found. None

    Modify the state of an existing job

    Code samples

    # You can also use wget
    curl -X PUT https://www.example.com/topics/jobs/{jobId}/state?value=canceled \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/state',
      method: 'put',
      data: '?value=canceled',
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.put('https://www.example.com/topics/jobs/{jobId}/state', params={
      'value': 'canceled'
    }, headers = headers)
    
    print r.json()
    
    

    PUT /jobs/{jobId}/state

    Modifies the state of an existing job. This endpoint is used to cancel a running job.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.
    value query string true The value to which the state of this topic was changed.

    Enumerated Values

    Parameter Value
    value canceled

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The state was successfully updated. See the response for the updated state. taskState
    400 Bad Request The specified state value was not valid. error2
    404 Not Found No results exist. The specified job ID was not found. error2

    Get the results of a job

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/jobs/{jobId}/results \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/results',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/topics/jobs/{jobId}/results', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/results

    Retrieves the results of a job. This endpoint is available only when the job state is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job for which results are retrieved.
    start query integer(int64) false The index of the first page to return.
    limit query integer(int32) false The maximum number of pages to return.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "id": "string",
          "name": "string",
          "termCutOff": 0,
          "termCount": 0,
          "documentCutOff": 0,
          "documentCount": 0,
          "version": 0
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The job results are available. jobResult
    404 Not Found No results exist. More information might be available through the /jobs/{jobId} endpoint.' error2

    Get the headers for the job results

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/topics/jobs/{jobId}/results
    
    
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/results',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/topics/jobs/{jobId}/results', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/results

    Retrieves the headers for the job results. It can also be used to check whether results exist. This endpoint is available only when the job state is completed.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job for which results are retrieved.
    start query integer(int64) false The index of the first page to return.
    limit query integer(int32) false The maximum number of pages to return.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The job results are available. None
    404 Not Found No results exist. More information might be available through the /jobs/{jobId} endpoint. None

    Get topics errors

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/jobs/{jobId}/errors \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.error+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.error+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/errors',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.error+json'
    }
    
    r = requests.get('https://www.example.com/topics/jobs/{jobId}/errors', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/errors

    Retrieves any errors that resulted from a job. The response might contain multiple errors through the nested errors array member. This endpoint is available only when the job state is failed. It is best accessed through the errors link from the job.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Example responses

    200

    {
      "message": "string",
      "id": "string",
      "errorCode": 0,
      "httpStatusCode": 0,
      "details": [
        "string"
      ],
      "remediation": "string",
      "errors": [
        null
      ],
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Job errors exist. error2
    204 No Content The job ID was found, but there are no errors for this job. None
    404 Not Found No results exist. The specified job ID was not found. error2

    Get the headers for the job errors

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/topics/jobs/{jobId}/errors
    
    
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/errors',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/topics/jobs/{jobId}/errors', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/errors

    Retrieves the headers for the job errors. It can also be used to check whether errors exist.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. Job errors exist. None
    404 Not Found No results exist. The specified job ID was not found. None

    Get the log for a job as plain text

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/jobs/{jobId}/log \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: text/plain'
    
    
    var headers = {
      'Accept':'text/plain'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/log',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'text/plain'
    }
    
    r = requests.get('https://www.example.com/topics/jobs/{jobId}/log', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log

    Retrieves the raw log from this job.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Example responses

    200

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The job log is available. string
    404 Not Found No results exist. The specified job ID was not found. error2

    Get the headers for the job log

    Code samples

    # You can also use wget
    curl -X HEAD https://www.example.com/topics/jobs/{jobId}/log
    
    
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/log',
      method: 'head',
    
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    
    r = requests.head('https://www.example.com/topics/jobs/{jobId}/log', params={
    
    )
    
    print r.json()
    
    

    HEAD /jobs/{jobId}/log

    Retrieves the headers for the log from this job. It can also be used to check whether the log exists.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The job log is available. None
    404 Not Found No results exist. The specified ID was not found. None

    Get the log for a job as a collection of log lines

    Code samples

    # You can also use wget
    curl -X GET https://www.example.com/topics/jobs/{jobId}/log#collection \
      -H 'Authorization: Bearer <access-token-goes-here>' \ 
      -H 'Accept: application/vnd.sas.collection+json'
    
    
    var headers = {
      'Accept':'application/vnd.sas.collection+json'
    
    };
    
    $.ajax({
      url: 'https://www.example.com/topics/jobs/{jobId}/log#collection',
      method: 'get',
    
      headers: headers,
      success: function(data) {
        console.log(JSON.stringify(data));
      }
    })
    
    
    import requests
    headers = {
      'Accept': 'application/vnd.sas.collection+json'
    }
    
    r = requests.get('https://www.example.com/topics/jobs/{jobId}/log#collection', params={
    
    }, headers = headers)
    
    print r.json()
    
    

    GET /jobs/{jobId}/log#collection

    Retrieves the log from this job, formatted as a collection of application/vnd.sas.compute.log.line objects.

    Parameters

    Parameter In Type Required Description
    jobId path string true The ID of the job.
    start query integer(int64) false The index of the first page to return.
    limit query integer(int32) false The maximum number of pages to return.

    Example responses

    200

    {
      "name": "string",
      "start": 0,
      "limit": 0,
      "count": 0,
      "accept": "string",
      "links": [
        {
          "method": "string",
          "rel": "string",
          "uri": "string",
          "href": "string",
          "title": "string",
          "type": "string",
          "itemType": "string",
          "responseType": "string",
          "responseItemType": "string"
        }
      ],
      "version": 0,
      "items": [
        {
          "version": 1,
          "type": "normal",
          "line": "string"
        }
      ]
    }
    

    Responses

    Status Meaning Description Schema
    200 OK The request succeeded. The job log is available. logLineCollection
    404 Not Found No results exist. The specified job ID was not found. error2

    Schemas

    taskState

    Properties

    Job State

    Name Type Required Description
    Job State string false The state of the job.
    Enumerated Values
    Property Value
    Job State pending
    Job State running
    Job State completed
    Job State canceled
    Job State failed

    jobRequest

    Properties

    Job Request

    Name Type Required Description
    description string false A brief description that tells more about this job.
    parentUri string true The URI of the input table that contains the input matrix.
    parentTermIdVariable string true The name of the column in the parent table that contains the term ID. This defaults to the term ID column name (TERMNUM) on the parent table that the Text Parsing API generates.
    parentDocumentIdVariable string true The name of the column in the parent table that contains the document ID. This defaults to the document ID column name (DOCUMENT) on the parent table that the Text Parsing API generates.
    termsUri string true The URI of the input table that contains the terms.
    topicCount integer(int32) false The number of topics that the API should generate. If this is not specified, a default value of 10 is used.
    maximumTopicCount integer(int32) false The maximum number of topics that the API should generate. It could generate less. You cannot specify this parameter if you specify the topicCount parameter.
    termDensityMultiple integer(int32) false Determines how many standard deviations above the mean to set the cutoff for topic terms.
    documentDensityMultiple integer(int32) false Determines how many standard deviations above the mean to set the cutoff for topic documents.
    outputTableNamePostfix string false The text to add at the end of the output table names. If this is left blank, the server generates it.
    configurationUri string false The URI of the (optional) text parsing configuration table. If it is present, the job modifies the contents of the configuration table.
    version integer(int32) true The schema version number of this media type. This representation is version 1.

    job

    Properties

    Job

    Name Type Required Description
    Job any false A topics job. This is the application/vnd.sas.text.topics.job media type.

    allOf

    Name Type Required Description
    anonymous jobRequest false A request to create a topics job. This is the application/vnd.sas.text.topics.job.request media type.

    and

    Name Type Required Description
    anonymous object false
    » id string true The ID that uniquely defines this topic.
    » state taskState true The current state of this topic.
    » creationTimeStamp string(date-time) true A string that contains the date and time value that the job originally created in the yyyy-mm-ddThh:mm:ssZ format.
    » version integer(int32) true The schema version number of this media type. This representation is version 1.

    jobResult

    Properties

    Job Result

    Name Type Required Description
    Job Result any false The output payload that represents the analysis results.

    allOf

    Name Type Required Description
    anonymous object false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)
    » name string false The name of the collection.
    » start integer(int64) false The zero-based index of the first item in the collection.
    » limit integer false The number of items that were requested for the collection.
    » count integer(int64) false The number of items in the collection.
    » accept string false A space-delimited list of media types from which an Accept header may be constructed.
    » links [any] false The links that apply to the collection.
    »» Link object false A link to a related operation or resource.
    »»» method string false The HTTP method for the link.
    »»» rel string true The relationship of the link to the resource.
    »»» uri string false The relative URI for the link.
    »»» href string false The URL for the link.
    »»» title string false The title for the link.
    »»» type string false The media type or link type for the link.
    »»» itemType string false If this is a link to a container, itemType is the media type or link type for the items in the container.
    »»» responseType string false The media type or link type of the response body for a PUT, POST, or PATCH operation.
    »»» responseItemType string false The media type or link type of the items in the response body for a PUT, POST, or PATCH operation.
    »» version integer false The version number of the collection representation. This representation is version 2.

    and

    Name Type Required Description
    » anonymous object false
    »» items [topicsJobResult] true The collection of results, where each entry corresponds to the result for one input document. The 'id' field links the results to input documents.

    topicsJobResult

    Properties

    Topics Job Result

    Name Type Required Description
    id string true The document identifier to which this result belongs.
    name string true The topic label, which typically includes the top five terms.
    termCutOff number(double) true The cutoff value that is used to determine whether a term is included in the topic.
    termCount integer(int32) false The number of terms in the topic.
    documentCutOff number(double) false The cutoff value that is used to determine whether a document is included in the topic.
    documentCount integer(int32) false The number of documents in the topic.
    version integer(int32) true The schema version number of this media type. This representation is version 1.

    jobCollection

    Properties

    Job Collection

    Name Type Required Description
    Job Collection any false

    allOf

    Name Type Required Description
    anonymous jobResult false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [job] false The array that contains jobs.

    logLineCollection

    Properties

    Log Line Collection

    Name Type Required Description
    Log Line Collection any false The collection of lines in the log file.

    allOf

    Name Type Required Description
    anonymous jobResult false This is a base schema used to define paginated collections of resources. This base schema is extended by other schemas in APIs by adding an 'items' array property. These extensions define the application/vnd.sas.collection media type (version 2)

    and

    Name Type Required Description
    anonymous object false
    » items [any] true
    »» Log Line object false A single line in a log. This is the application/vnd.sas.compute.log.line media type.
    »»» version integer(int32) true The version number of the Log Line (logLine) representation. This is version 1.
    »»» type string true The line entry classification.
    »»» line string true The line of text without the type (classification) prefix marker.
    Enumerated Values
    Property Value
    type normal
    type highlighted
    type source
    type title
    type byline
    type footnote
    type error
    type warning
    type note
    type message

    error2

    Properties

    Error

    Name Type Required Description
    message string false The message for the error.
    id string false The string ID for the error.
    errorCode integer false The numeric ID for the error.
    httpStatusCode integer true The HTTP status code for the error.
    details [string] false Messages that provide additional details about the cause of the error.
    remediation string false A message that describes how to resolve the error.
    errors [error2] false Any additional errors that occurred.
    links [jobResult/allOf/0/properties/links/items] false The links that apply to the error.
    version integer true The version number of the error representation. This representation is version 2.

    Usage Notes

    Overview

    Topics are statistically generated categories. You create the name of a topic using the top-level terms in the topic such as "wii, nintendo, mario, gamecube, zelda."

    The Topics API takes two tables as inputs: - a parent table that provides a term or document matrix - a term table

    Typically, you produce these tables using the Text Parsing API. The the names of two tables that contain the topics and the topic terms are the output for the API.

    This API uses an asynchronous execution model. The client creates a topics job that runs in the background after the CREATE operation returns. The API provides resource endpoints for checking the state of the request. After this completes, results are retrieved using either the /results endpoint on the job or by interacting with the result table directly using another SAS service such as the CAS Management service.

    Terminology

    job

    a container for an asynchronous operation. A job supports a number of different operations such as checking a state or canceling an operation. All topics operations are performed asynchronously.

    library

    a container for inputs and outputs when you use CAS. The Topics API and other APIs such as the Categorization API use a library to locate input data and store output tables that they create.

    table

    an input to and output from topics that you generate.

    topic

    a set of terms, each of which has an associated weight. The top-level terms provide the topic label.

    Resources

    Resource Relationships

    This diagram shows the relationships among the resources in this API.

    Topics entity relationship diagram

    Root

    Path: /

    The root of the API. This resource contains links to the top-level resources in the API. The response uses the application/vnd.sas.api media type.

    The GET / response includes these links.

    Relation Method Description
    jobs GET Returns the first page of the collection of jobs.
    URI: /jobs
    Response type: application/vnd.sas.collection
    Response item type: application/vnd.sas.text.topics.job
    startTopics POST Submits a new topics job for execution.
    URI: /jobs
    Request type: application/vnd.sas.text.topics.job.request.
    Response type: application/vnd.sas.text.topics.job

    Jobs

    Path: /jobs

    This API provides collections of jobs. Members of the /jobs collection are job resources, /job/{jobId}. (See below.)

    The GET operation on this path returns a application/vnd.sas.collection collection. This collection response includes the links in this table.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection without sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection. This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection. This link is omitted if the current view is on the last page of the collection.
    first GET Returns the first page of resources from the collection. This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection. This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    Sorting and Filtering

    You can sort and filter this collection using the ?sortBy= and ?filter= query parameters.

    Sorting and filtering can use these members of the Job resource:

    Job

    Path: /jobs/{jobId}

    A specific job resource.

    A job resource has the link relations that are described in this table in the appication/vnd.sas.text.topics.job representation.

    Relation Method Description
    self GET Retrieves the job itself.
    URI: /jobs/{jobId}
    Response type: application/vnd.sas.text.topics.job
    delete DELETE Deletes the job.
    URI: /jobs/{jobId}
    state GET Retrieves the job state.
    URI: /jobs/{jobId}/state
    Response type: text/plain
    cancel PUT Cancels the job.1
    URI: /jobs/{jobId}/state?value=canceled
    results GET Retrieves the job results.2
    URI: /jobs/{jobId}/results
    Response type: application/vnd.sas.text.topics.job.results
    errors GET Retrieves any errors that are associated with the job.3
    URI: /jobs/{jobId}/errors
    Response type: application/vnd.sas.error
    log GET Retrieves the log that is associated with the job.
    URI: /jobs/{jobId}/log
    Response type: text/plain or application/json
    caslib GET Retrieves the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib

    1 Available only when the job state is 'pending' or 'running'.
    2 Available only when the job state is 'completed'.
    3 Available only when the job state is 'failed' or 'canceled'.

    Job Results

    Path: /jobs/{jobId}/results

    The results from a specific topics job. This path returns a collection of application.vnd.sas.topics.job.result objects.

    The GET operation on this path returns a application/vnd.sas.collection collection. This collection response includes the links that are described in this table.

    Relation Method Description
    self GET Returns the current page from the collection.
    collection GET Returns the first page of the collection without sorting or filtering criteria.
    prev GET Returns the previous page of resources from the collection. This link is omitted if the current view is on the first page.
    next GET Returns the next page of resources from the collection. This link is omitted if the current view is on the last page of the collection.
    first GET Returns the first page of resources from the collection. This link is omitted if the current view is on the first page.
    last GET Returns the last page of resources from the collection. This link is omitted if the current view is on the last page.
    up GET Returns the parent resource.
    caslib GET Retrieves the library for the results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}
    Response type: application/vnd.sas.cas.caslib
    topicsTable GET Retrieves the backing table for topics results.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    termTopicsTable GET Retrieves the backing table that contains the terms for each topics result.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    documentProjectionsTable GET Retrieves the backing table for document projections.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table
    wordProjectionsTable GET Retrieves the backing table for word projections.
    URI: /casManagement/servers/{serverName}/caslibs/{caslib}/tables/{tableName}
    Response type: application/vnd.sas.cas.table

    Media Types

    application/vnd.sas.text.topics.job.request+json

    The vnd.sas.text.topics.job.request media type represents a request to start a topics job that processes a table as input.

    This is described by jobRequest.

    { "description": "My table request", "parentUri": "/casManagement/servers/cas/caslibs/lib/tables/parent", "parentTermIdVariable": "TERMNUM", "parentDocumentIdVariable": "DOCUMENT", "termsUri": "/casManagement/servers/cas/caslibs/lib/tables/terms", "topicCount": 10, "maximumTopicCount": 50, "termDensityMultiple": 2, "documentDensityMultiple": 1, "outputTableNamePostfix": "-TMP", "inputUri": "/casManagement/servers/cas/caslibs/lib/tables/input", "documentIdVariable": "id", "textVariable": "text" }

    application/vnd.sas.text.topics.job+json

    The vnd.sas.text.topics.job media type represents a job that was created to derive topics from text data. That job must have been started to process a CAS table using the application/vnd.sas.text.topics.job.request media type.

    This is described by job.

    { "version": 1, "parentUri": "/casManagement/servers/cas/caslibs/lib/tables/input_PARSING_PARENT_OUT_f0250e89-5475-4de5-bddf-1f78b3a3a4f9", "parentTermIdVariable": "TERMNUM", "parentDocumentIdVariable": "DOCUMENT", "termsUri": "/casManagement/servers/cas/caslibs/lib/tables/input_PARSING_TERMS_OUT_f0250e89-5475-4de5-bddf-1f78b3a3a4f9", "id": "35794141-01a1-45e7-b760-24bef36d127a", "state": "completed", "creationTimeStamp": "2017-09-08T20:48:01.053Z", "links": [ { "method": "GET", "rel": "self", "href": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a", "uri": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a", "type": "application/vnd.sas.text.topics.job" }, { "method": "DELETE", "rel": "delete", "href": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a", "uri": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a" }, { "method": "GET", "rel": "state", "href": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a/state", "uri": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a/state", "type": "text/plain" }, { "method": "GET", "rel": "log", "href": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a/log", "uri": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a/log", "type": "text/plain" }, { "method": "GET", "rel": "results", "href": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a/results", "uri": "/topics/jobs/35794141-01a1-45e7-b760-24bef36d127a/results", "type": "application/vnd.sas.collection" }, { "method": "GET", "rel": "caslib", "href": "/casManagement/servers/cas/caslibs/lib", "uri": "/casManagement/servers/cas/caslibs/lib", "type": "application/vnd.sas.cas.caslib" } ] }

    application/vnd.sas.text.topics.job.result+json

    The vnd.sas.text.topics.job.result media type represents the topics that are derived for a specific document.

    This is described by topicsJobResult.

    { "version": 1, "id": "2", "name": "hdd, psp, slim, capable, +accessory", "termCutOff": 0.031, "numberOfTerms": 275, "documentCutOff": 0.333, "numberOfDocuments": 285 }

    application/vnd.sas.api

    Contains top-level links for an API. See application/vnd.sas.api.

    application/vnd.sas.collection

    A paginated, filterable, sortable collection of resource representations. See application/vnd.sas.collection.

    application/vnd.sas.error

    A detailed description of an error. See application/vnd.sas.error.

    application/vnd.sas.compute.log.line

    A single line from a log file. For this API, executing a job creates the log. See application/vnd.sas.compute.log.line.

    Error Codes

    HTTP Status Code Error Code Description
    400 71100 You can specify either topicCount or maximumTopicCount, not both.
    400 71101 The parent, terms, and configuration tables must reside in the same library if you specify them.
    400 71205 The specified state value is not a valid state.
    400 71206 The specified state value is not valid. Only the 'canceled' state is permitted.
    400 71212 The specified paging parameters (start or limit) are not valid.
    404 71200 The specified job ID could not be found.
    404 71202 Results are not yet available because the job is still running.
    404 71203 Results are not available because the job was canceled.
    404 71204 Results are not available because the job failed. More information might be available from the /errors endpoint.
    404 71210 The specified CAS library is not valid. No CAS library exists at the requested path.
    404 71211 The specified URI is not valid. It does not exist at the requested path.
    409 71201 You must cancel the job before you can delete it.
    409 71207 You cannot cancel the job because it has already completed.
    500 71208 The results could not be retrieved.
    500 71209 The specified data could not be saved.