• Resolved katieTBH

    (@katietbh)


    I have a custom role ‘Client’. I have added the ‘Support User’ capabilities to the ‘Client’ role. From the frontend a Client user can complete all tasks including creating a new ticket.

    When I make requests from Postman to /wp-json/wpas-api/v1/tickets to view, close, reply or attach files they are successful. But when I try to create a new ticket I get the response;

    {
    “code”: “rest_cannot_assign_term”,
    “message”: “Sorry, you are not allowed to assign the provided terms.”,
    “data”: {
    “status”: 403
    }
    }

    If I remove the Client role and just use the Support User role the request succeeds.

    Do you know what could potentially be causing this?

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Katie! Can you post a sample of the request you are making with Postman?

    There is a function that runs as part of the Create Ticket request that ensures that the current user can assign all terms being sent with the request. You can see that here: https://github.com/Awesome-Support/Rest-API/blob/master/includes/API/Tickets.php#L233

    It sounds like the permissions are not properly set for any terms that you are trying to define.

    -Tanner

    Thread Starter katieTBH

    (@katietbh)

    Here is the sample request. (modified only to remove private info)

    POST /portal/wp-json/wpas-api/v1/tickets
    cache-control: no-cache
    postman-token: 8a6fe1cd-da97-4669-bcbc-23cc88f1d0
    authorization: Bearer eyJ0…
    user-agent: PostmanRuntime/6.4.1
    accept: */*
    host: s1.solutions
    cookie: smtl-test-cookie=smtl-test-cookie; PHPSESSID=lg1g8oqb3d30eqeearvap5; smtl-test-cookie=WP+Cookie+check; _wpas_session=f06fd93c7f9c726360;
    accept-encoding: gzip, deflate
    content-type: multipart/form-data; boundary=————————–90761816893347195517423
    content-length: 324
    title=This is a new messagecontent=This is the content of a new message.

    HTTP/1.1 403
    status: 403
    date: Thu, 15 Feb 2018 03:21:57 GMT
    server: Apache
    x-powered-by: PHP/5.6.33
    pragma: no-cache
    x-robots-tag: noindex
    link: <https://s1.solutions/portal/wp-json/&gt;; rel=”https://api.w.org/&#8221;
    x-content-type-options: nosniff
    access-control-expose-headers: X-WP-Total, X-WP-TotalPages
    access-control-allow-headers: Authorization, Content-Type
    expires: Wed, 11 Jan 1984 05:00:00 GMT
    cache-control: no-cache, must-revalidate, max-age=0
    allow: GET
    set-cookie: _wpas_session=f06fd93c7f9c; expires=Thu, 15-Feb-2018 03:44:23 GMT; Max-Age=1345;
    keep-alive: timeout=5, max=100
    connection: Keep-Alive
    transfer-encoding: chunked
    content-type: application/json; charset=UTF-8
    {“code”:”rest_cannot_assign_term”,”message”:”Sorry, you are not allowed to assign the provided terms.”,”data”:{“status”:403}}

    Thanks Katie!

    I’m going to try and duplicate this error on my development site. Can you tell me how you are creating the new user role? Is it a plugin or code?

    Thread Starter katieTBH

    (@katietbh)

    The role is created through code and it may be difficult to duplicate. I’m happy to share more info with you privately but should I buy support token?

    Plugin Author awesomesupport

    (@awesomesupport)

    @katietbh:

    Shoot, we completely missed your comment on this for some reason. I am so sorry about that. Usually www.ads-software.com sends us emails about replies but somehow we missed this one one. We’re not usually this tardy on responses.

    Hands-on custom code troubleshooting would generally involve opening a special project that is billed on a time and materials basis. If this is something you need please drop us a note on our contact form on our site and we can help guide you to what’s needed.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘API rest_cannot_assign_term Create Ticket Issue’ is closed to new replies.