최근 검색


최근 검색 없음

Edouard PIGEON's Avatar

Edouard PIGEON

가입한 날짜: 2023년 4월 12일

·

마지막 활동: 2023년 5월 26일

팔로잉

0

팔로워

0

총 활동 수

7

투표 수

0

플랜 수

2

활동 개요

님의 최근 활동 Edouard PIGEON

Edouard PIGEON님이 에 댓글을 입력함

커뮤니티 댓글 Developer - Zendesk APIs

Someone find a way to get this working : https://stackoverflow.com/questions/18387427/using-curl-to-post-json-with-php-variables

I add this line in the "POST" case of curlWrap function :

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json', 'Content-Length: ' . strlen($json), 'X-HTTP-Method-Override: POST'));

댓글 보기 · 2023년 5월 26일에 게시됨 · Edouard PIGEON

0

팔로워

0

투표 수

0

댓글


Edouard PIGEON님이 에 게시물을 만듦

게시물 Developer - Zendesk APIs

Hello,

I'm using PHP/CURL to manage identities of my Zendesk contacts.

I can right now list users, identities and remove identities but I'm stuck when trying to create a new identity for an existing user.

My example (this is simplified) :

$dataAI = 'https://xxxxx.zendesk.com/api/v2/users/212121212112/identities.json';
$create = '{"identity":{"type":"phone_number","value":"+3312121212"}}';

Called like this :

curlWrap($dataAI, $create, "POST");

Here is the Curl function :

function curlWrap($url, $json, $action)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERPWD, ZDUSER."/token:".ZDAPIKEY);
    switch($action){
        case "POST":
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
            break;
        case "GET":
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
            break;
        case "PUT":
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
            curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
            break;
        case "DELETE":
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
            break;
        default:
            break;
    }

    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/binary; charset=utf-8', 'Accept: application/json; charset=utf-8'));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $output = curl_exec($ch);
    curl_close($ch);
    $decoded = json_decode($output, true);
    return $decoded;
}

Am I missing something ?

2023년 5월 26일에 게시됨 · Edouard PIGEON

0

팔로워

2

투표 수

2

댓글


Edouard PIGEON님이 에 댓글을 입력함

커뮤니티 댓글 Developer - Zendesk APIs

Thanks for your detailed answer.

My syntax was right but it seems that our CRM integration (from 3CX phone system) wants to create an new option and not just setting it as the logs says :

2023/04/13 16:47:48.805|2445|0041|Erro|CRM: Exception during call reporting: System.ArgumentException: Can not add property custom_fields to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.

댓글 보기 · 2023년 4월 13일에 게시됨 · Edouard PIGEON

0

팔로워

0

투표 수

0

댓글


Edouard PIGEON님이 에 댓글을 입력함

커뮤니티 댓글 Developer - Zendesk APIs

Hi,

Yes, I'm already using the tag not the title.

Is the syntax the same between "custom_fields" and "custom_field_option" ?

Do I only have to specify the dropdown list ID and it's value ?

I can't find any example.

댓글 보기 · 2023년 4월 12일에 게시됨 · Edouard PIGEON

0

팔로워

0

투표 수

0

댓글


Edouard PIGEON님이 에 게시물을 만듦

게시물 Developer - Zendesk APIs

Hello,

I'm looking to create through API a new ticket with a specific custom_field_option.

This example works fine with custom field :

{
  "ticket": {
    "subject": "New ticket",
    "custom_fields": [{  "id": 6546465464, "value": "test"   }]  
  }
}

But I can't figured it out with dropdown lists (custom_field_option).

Is there anything special to know ?

2023년 4월 12일에 게시됨 · Edouard PIGEON

0

팔로워

3

투표 수

3

댓글