Client.request API call "X-Zendesk-API-Warn" but ok using ajax call

6 Comments

  • Jonathan Brown
    Comment actions Permalink

    Worth adding:

    I got the X-Zendesk-API-Warn in a legit matter* later on using ajax, so ajax doesn't completely remove that warning, however in this particular instance for a simple ticketfield request, it did. 


    **Legit matter meaning i was attempting to pass in field like raw_ticket_title which are unneeded. 

    0
  • Jonathan Brown
    Comment actions Permalink

    Also, these warns should stop a 200 response surely? 

    the PUT for /api/v2/ticket_forms/${ticketForm.id}.json gives a 200 everytime even when passing in params I shouldn't, but no changes are made because of the bad params.

    {
    active
    true
    agent_conditions[]
    defaulttrue
    display_name"Default Ticket Form"
    end_user_conditions[]
    end_user_visibletrue
    in_all_brandstrue
    name"Default Ticket Form"
    position0
    ticket_field_ids[360001325431, 360001325491, 360001325511, 360001325391, 360001325411, 360003913352, 360003913332,…]
    }

    passing the above without wrapping it in a "ticketform:{}" gave me X-Zendesk-API-Warn for params active and agent conditions, which is completely unhelpful. 

     

    0
  • Joseph May
    Comment actions Permalink

    Hi there Jonathan-
    A colleague is going to work with you on this, having already started an investigation. In the meantime, I wanted you to know I edited a comment that contained your subdomain. I know it is a sandbox, not production; in either event prudent.
    As far as the warning-level messages go, there is not limit. A lot of times they are noise, between you & I, and engineering teams are working on addressing them over time.

    0
  • Bryan Flynn
    Comment actions Permalink

    Hi Jonathan -- give this a try. You have to pass in contentType as well:

    let ticketField = 
    {
    "ticket_field": {
    "type": "tagger",
    "title": "JBTestApp",
    "custom_field_options": [
    {
    "name": "JB TEST 1",
    "value": "jbtest1"
    },
    {
    "name": "JB TEST 2",
    "value": "jbtest2"
    }
    ]
    }
    };

    let requestParams = {
    type: "POST",
    url: "/api/v2/ticket_fields.json",
    dataType: "json",
    contentType: "application/json",
    data: JSON.stringify(ticketField)
    };

    client.request(requestParams).then(
    function(data) {
    console.log("success:", data);
    },
    function(error) {
    console.log("error:", error);
    }
    );
    0
  • Jonathan Brown
    Comment actions Permalink

    Oh wow that's all it was! thank you!

    Can we get this page updated to include contentType too please
    https://developer.zendesk.com/apps/docs/core-api/client_api#client.requestoptions

     

    And thanks for removing the sandbox url, oops!

    0
  • Christopher Cooper
    Comment actions Permalink

    Hi Jonathan,

    I put in a request to include contentType in the client.request argument list. That should be updated soon.

    0

Please sign in to leave a comment.

Powered by Zendesk