Changing the author of a Help Center article Follow

Comments

6 comments

  • Avatar
    itoperations

    For Python 3.4.3 on Windows, I had to change the braces around the variables to single quotes. Otherwise I kept getting an error about the content not being serializable: "TypeError: {104XXXXXX} is not JSON serializable". New code reads:
    # Settings
    article_id = '205YYYY18'
    updated_author_id = '104207XXXX'
    zendesk_subdomain = 'ZZZhelphelp'
    email = 'jenniferVVV@vvvv.com.au'
    password = 'IsComplex'

  • Avatar
    itoperations

    Hmmm ... formatting has gone nuts. Anyway, don' use "{xx}", use 'xx' instead.

  • Avatar
    Charles Nadeau

    Thanks, itoperations. We use curly braces in the docs to denote values the user must provide, but of course curly braces are also used in Python for dictionaries. It's ambiguous and confusing, agreed, so I removed the curly braces from the user-defined values in the sample script.

  • Avatar
    Paresh Parmar

    ok

  • Avatar
    Jason

    I just went through the process of setting up curl on my Windows computer and successfully tested it. When I tried the example shown above, I get this error: < HTTP/1.1 422 Unprocessable Entity. Below is what I entered and what was returned. Can you tell me what might be the problem?


    C:\Users\mycomputername>curl https://ourcompany.zendesk.com/api/v2/help_center/articles/215887887.json -d '{"article": {"author_id": 3189648487}}' -X PUT -H "Content-Type: application/json" -v -u myemailname@mydomain.com:pa$$word



    * Adding handle: conn: 0x20f53e0
    * Adding handle: send: 0
    * Adding handle: recv: 0
    * Curl_addHandleToPipeline: length: 1
    * - Conn 0 (0x20f53e0) send_pipe: 1, recv_pipe: 0
    * About to connect() to ourcompany.zendesk.com port 443 (#0)
    * Trying 192.161.154.1...
    * Connected to ourcompany.zendesk.com (192.161.154.1) port 443 (#0)
    * successfully set certificate verify locations:
    * CAfile: c:\curl\curl-ca-bundle.crt
    CApath: none
    * SSLv3, TLS handshake, Client hello (1):
    * SSLv3, TLS handshake, Server hello (2):
    * SSLv3, TLS handshake, CERT (11):
    * SSLv3, TLS handshake, Server finished (14):
    * SSLv3, TLS handshake, Client key exchange (16):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSLv3, TLS change cipher, Client hello (1):
    * SSLv3, TLS handshake, Finished (20):
    * SSL connection using AES256-SHA
    * Server certificate:
    * subject: C=US; postalCode=94103; ST=California; L=San Francisco; street=989 MARKET ST STE 300; O=Zendesk Inc.; OU=PremiumSSL Wildcard; CN=*.zendesk.com
    * start date: 2014-08-26 00:00:00 GMT
    * expire date: 2019-08-25 23:59:59 GMT
    * subjectAltName: ourcompany.zendesk.com matched
    * issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Organization Validation Secure Server CA
    * SSL certificate verify ok.
    * Server auth using Basic with user 'myemailname@mydomain.com'
    > PUT /api/v2/help_center/articles/215887887.json HTTP/1.1
    > Authorization: Basic am...{etc...}==
    > User-Agent: curl/7.33.0
    > Host: ourcompany.zendesk.com
    > Accept: */*
    > Content-Type: application/json
    > Content-Length: 10
    >
    * upload completely sent off: 10 out of 10 bytes
    < HTTP/1.1 422 Unprocessable Entity
    * Server nginx is not blacklisted
    < Server: nginx
    < Date: Thu, 10 Mar 2016 17:31:39 GMT
    < Transfer-Encoding: chunked
    < Connection: keep-alive
    < Status: 422 Unprocessable Entity
    < X-Zendesk-Origin-Server: hcapp14.pod5.iad1.zdsys.com
    < Set-Cookie: _help_center_session=SE1...{etc...}; path=/; HttpOnly
    < X-Request-Id: 9093e6f1-8ef1-47b5-c791-b8ca3a6b1aa9
    < X-Runtime: 0.016254
    <
    Unprocessable Entity* Connection #0 to host ourcompany.zendesk.com left intact
    curl: (3) [globbing] unmatched brace in column 1
    curl: (3) [globbing] unmatched close brace/bracket in column 11

  • Avatar
    Charles Nadeau

    Hi Jason, 


    The Windows command prompt doesn't support single quotes, which is a problem because cURL uses them to enclose JSON data:


    -d '{"article": {"author_id": 3189648487}}'

    The solution is to save the JSON in a separate file and import it into the cURL statement. The following article shows you how:


    https://support.zendesk.com/hc/en-us/articles/203691436#toc_1


     

Please sign in to leave a comment.

Powered by Zendesk