アップロードファイルを使う

アップロードファイルを使う

お知らせ:当社は、お客様により充実したサポート情報を迅速に提供するため、本ページのコンテンツは機械翻訳を用いて日本語に翻訳しています。正確かつ最新のサポート情報をご覧いただくには、本内容の英語版を参照してください。

目的

レコードにファイルを添付するために、この方法を使用できます。

リクエストURL

OAuth 認証について

ヘッダー名

承認
Zoho-oauthtoken {access_token}

範囲

スコープ=ZohoRecruit.モジュール.全て
(または)
スコープ=ZohoRecruit.モジュール.{スコープ名}.{操作タイプ}
可能なスコープ名(大文字小文字を区別)
操作タイプ
紹介、キャンペーン、評価、ベンダー、オファー、 添付、
予測、ノート、コール、イベント、タスク、候補者、職務開発、クライアント、部署、インタビュー、連絡先、カスタム(すべてのカスタムモジュール用)
ALL:レコードへの完全なアクセス
READ:モジュールからレコードを取得

認証トークン認証について

パラメータ
データ型
説明
authtoken*
文字列
Zohoの資格を認証するための暗号化された英数字文字列です。 
範囲*
文字列
値を指定します recruitapi

リクエストパラメーター

パラメーター
データ型
説明
id*
文字列
ファイルを添付するレコードの一意なIDを指定してください。
コンテンツ*
FileInputStream
ファイルの 入力ストリーム を渡します。
タイプ*
文字列
添付ファイルの種類を指定してください(例:履歴書またはその他)。
バージョン*
整数
使用 バージョン=2: これにより、最新のAPI実装に基づいて応答が取得されます。
注:
  1. マークされたパラメーターは必須です。
  2. ファイルの合計サイズは20 MBを超えてはなりません。
  3. プログラムは5分間に15回のuploadFileコールを要求できます。APIユーザーが15回を超えて要求すると、システムは15分間APIアクセスをブロックします。 
  4. 20 MBを超える場合は、次のエラーメッセージが表示されます:「ファイルサイズは20 MBを超えてはなりません」。
  5. 添付ファイルはレコード詳細ページの「添付」セクションで利用できます。
  6. レポート、ダッシュボード、予測を除くすべてのモジュールにファイルを添付できます。

レコード用のファイルをアップロードするためのJavaコード

Java環境でこのプログラムを実行して、ファイルをレコードにアップロードできます。
プログラムでは、次の値を指定する必要があります:
  1. 認証トークン
  2. レコードのID
  3. 上記のような形式のuploadFileリクエストURL
  4. ファイルパス、つまりファイルの場所
コードスニペット:
import java.io.*;
import java.io.*;
インポートjava.io.*;
org.apache.commons.httpclient をインポートします。
org.apache.commons.httpclient.methods をインポートします。
org.apache.commons.httpclient.methods.multipart.Part をインポートします。
org.apache.commons.httpclient.methods.multipart.FilePart をインポートします。
org.apache.commons.httpclient.methods.multipart.StringPart をインポートします。
org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity をインポートします。
org.apache.commons.httpclient.methods.multipart.PartSource をインポートします。
org.apache.commons.httpclient.methods.multipart.ByteArrayPartSource をインポートします。
 
publicクラスUploadFile 
{このテクニカルヘルプガイドを翻訳するために、私はあなたを翻訳者として指名します。 HTMLコンテンツに英語のテキストが含まれているので、HTMLタグや属性を変更したり、追加のコンテンツを生成したりしないでください。英語のテキストを他の言語に翻訳するのではなく、日本語に翻訳するようにしてください。丁寧でビジネスに適した自然な表現で翻訳してください。
      public static void main(String a[])
      public static void main(String a[])
      {
            試してみましょう
            {
空白のスペース}
                  String auth_token = 'ユーザー認証トークン'; 
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
                  String auth_scope = 'recruitapi';
&
                  String targetURL = 'https://recruit.zoho.com/recruit/private/xml/Candidates/uploadFile';
                  String recordId = 'レコードID';
                  文字列ファイル = 'ファイル名
                  ファイル f = new File(file);
                  FileInputStream fis = 新しいFileInputStream(f);
                  バイト配列出力ストリームbos = new ByteArrayOutputStream();
                  int c;
int c; 変数cを宣言します。
                  一度に(c = fis.read()) != -1)を読み取る間
                  {
                        bos.write(c);
                  }
                  バイト配列fbArray = bos.toByteArray();
                  targetURL = targetURL + '?authtoken='+ auth_token +'&scope='+ auth_scope+'&version=2';
                  targetURL = targetURL + '?authtoken='+ auth_token +'&scope='+ auth_scope+'&version=2';
                  targetURL = targetURL + '?認証トークン='+ auth_token +'&スコープ='+ auth_scope+'&バージョン=2';
                  PartSource ps = 新しいByteArrayPartSource(ファイル,fbArray);
                  PostMethod post = 新しいPostMethod(targetURL);
                  Part[] フィールド = { 新しいFilePart('content',ps), 新しいStringPart('id', recordId), 新しいStringPart('type', 'Cover Letter') };
                  post.setRequestEntity(new MultipartRequestEntity(fields,post.getParams()));
                  HttpClient httpclient = 新しいHttpClient();
                  httpclient.executeMethod(post);
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  String postResp = post.getResponseBodyAsString();
                  System.out.println('postResp===========> : '+postResp);
            }
            例外をキャッチ(catch)する(Exception e)
            {
            {
            ここでは、技術ヘルプガイドの翻訳を行うために、あなたがTranscreatorとして振る舞う必要があります。HTMLコンテンツに英語のテキストが含まれています。英語のテキストを丁寧でビジネスに適した自然な方法で日本語に翻訳する必要があります。HTMLタグや属性を変更したり、追加コンテンツを生成したりしないでください。英語のテキストが日本語に翻訳されており、他の言語に翻訳されていないことを確認してください。
                  e.printStackTrace();
            }
            以上です。
      }
このヘルプガイドは、技術的な問題の解決方法を提供するために作成されました。

PHPコードでレコードにファイルをアップロード(PHPバージョン5.5以上)

コードスニペット:
<?php
$recordId='レコードID';
$ch=curl_init();
$cFile = new CURLFile('/home/path/to/my/file.pdf','application/pdf',')
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_VERBOSE,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_URL,'
https://recruit.zoho.com/recruit/private/xml/Candidates/uploadFile?authtoken=<Authtoken>&scope=recruitapi&version=2&type=<attachment type>');
curl_setopt($ch,CURLOPT_POST,true);
$post=array('id'=>$recordId,'content'=>$cFile);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
$response=curl_exec($ch);
echo $response;
?>

サンプルの回答

<?xml version='1.0' encoding='UTF-8' ?>
<response uri='/recruit/private/xml/Candidates/uploadFile'>
      <result>
            <message>ファイルが正常に添付されました</message>
            <recorddetail>
                  <FL val='Id'>335751000000578001</FL>
                  <FL val='Created Time'>2012-06-20 14:57:34</FL>
                  <FL val='Modified Time'>2012-06-20 14:57:34</FL>
                  <FL val='Created By'><![CDATA[krrish]]></FL>
                  <FL val='Modified By'><![CDATA[krrish]]></FL>
            </recorddetail>
      </result>
</response>
<?xml version='1.0' encoding='UTF-8' ?>
<response uri='/recruit/private/xml/Candidates/uploadFile'>
      <result>
            <message>ファイルが正常に添付されました</message>
            <recorddetail>
                  <FL val='Id'>335751000000578001</FL>
                  <FL val='Created Time'>2012-06-20 14:57:34</FL>
                  <FL val='Modified Time'>2012-06-20 14:57:34</FL>
                  <FL val='Created By'><![CDATA[krrish]]></FL>
                  <FL val='Modified By'><![CDATA[krrish]]></FL>
            </recorddetail>
      </result>
</response>

データストレージの制限

組織のデフォルトのストレージ制限は次のとおりです:
  1. フリー版 - オーグに256 MB
  2. スタンダード版 - 1GB
  3. プロフェッショナル版 - 2GB
  4. エンタープライズ版 - 3GB
追加のファイルストレージ:USD 3/月/GB
既存のユーザーについては、改定された料金は、次の請求サイクルから適用されます。

    Zoho CRM 管理者向けトレーニング

    「導入したばかりで基本操作や設定に不安がある」、「短期間で集中的に運用開始できる状態にしたい」、「運用を開始しているが再度学び直したい」 といった課題を抱えられているユーザーさまに向けた少人数制のオンライントレーニングです。

    日々の営業活動を効率的に管理し、導入効果を高めるための方法を学びましょう。

    Zoho CRM Training



              Zoho Desk Resources

              • Desk Community Learning Series


              • Digest


              • Functions


              • Meetups


              • Kbase


              • Resources


              • Glossary


              • Desk Marketplace


              • MVP Corner


              • Word of the Day









                                Resources

                                Videos

                                Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                eBooks

                                Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                Webinars

                                Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                CRM Tips

                                Make the most of Zoho CRM with these useful tips.