商品分类
电影影讯
查询今日上映电影,电影信息,电影院及上映信息。
价格
¥198

交付方式
API交付

提供API调用额度和鉴权信息

使用期限

优质服务商家

7*8小时在线客服

专业测试保证品质

API文档

获取电影城市

调用地址:http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city

请求方式:GET

返回类型:JSON

API调用: API调用说明(secret_id & secret_key)

请求参数(Headers)

名称
类型
是否必须
描述
暂无数据

请求参数(Query)

名称
类型
是否必须
描述
parentid
string
上级ID

请求参数(Body)

名称
类型
是否必须
描述
暂无数据

请求示例

# -*- coding: utf-8 -*-
from __future__ import print_function

import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime

try:
    from urllib import urlencode
    from urllib2 import Request, urlopen
except ImportError:
    from urllib.parse import urlencode
    from urllib.request import Request, urlopen

# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"

# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))

# 请求方法
method = 'GET'
# 请求头
headers = {
    'X-Source': source,
    'X-Date': datetime,
    'Authorization': auth,
}
# 查询参数
queryParams = {
    'parentid': ''}
# body参数(POST方法下存在)
bodyParams = {
}
# url参数拼接
url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city'
if len(queryParams.keys()) > 0:
    url = url + '?' + urlencode(queryParams)

request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
    request.data = urlencode(bodyParams).encode('utf-8')
    request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
    print(content.decode('utf-8'))
curl -v -X GET http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city ?parentid=-H 'Host:service-2n6vk134-1257101137.gz.apigw.tencentcs.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest' 
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';

// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);

// 请求方法
$method = 'GET';
// 请求头
$headers = array(
    'X-Source' => $source,
    'X-Date' => $datetime,
    'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
    'parentid' => '',
);
// body参数(POST方法下)
$bodyParams = array (
);
// url参数拼接
$url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city';
if (count($queryParams) > 0) {
    $url .= '?' . http_build_query($queryParams);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
    return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($bodyParams));
}

$data = curl_exec($ch);
if (curl_errno($ch)) {
    echo "Error: " . curl_error($ch);
} else {
    print_r($data);
}
curl_close($ch);
/**
 * npm install crypto-js request
 */
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');

// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";

// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';

// 请求方法
var method = 'GET';
// 请求头
var headers = {
    "X-Source": source,
    "X-Date": datetime,
    "Authorization": auth,
}
// 查询参数
var queryParams = {
    'parentid': ''}
// body参数(POST方法下)
var bodyParams = {
}
// url参数拼接
var url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city';
if (Object.keys(queryParams).length > 0) {
    url += '?' + querystring.stringify(queryParams);
}

var options = {
    url: url,
    timeout: 5000,
    method: method,
    headers: headers
}
if (['POST', 'PUT', 'PATCH'].indexOf(method) != -1) {
    options['body'] = querystring.stringify(bodyParams);
    options['headers']['Content-Type'] = "application/x-www-form-urlencoded";
}

request(options, function (error, response, body) {
    if (error !== null) {
        console.log('error:', error);
        return;
    }
    console.log(body);
});
package main

import (
    "crypto/hmac"
    "crypto/sha1"
    "encoding/base64"
    "fmt"
    "io"
    "io/ioutil"
    "net/http"
    gourl "net/url"
    "strings"
    "time"
)

func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
    timeLocation, _ := time.LoadLocation("Etc/GMT")
    datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
    signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)

    // hmac-sha1
    mac := hmac.New(sha1.New, []byte(secretKey))
    mac.Write([]byte(signStr))
    sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))

    auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
        secretId, sign)

    return auth, datetime, nil
}

func urlencode(params map[string]string) string {
    var p = gourl.Values{}
    for k, v := range params {
        p.Add(k, v)
    }
    return p.Encode()
}

func main() {
    // 云市场分配的密钥Id
    secretId := "xxxx"
    // 云市场分配的密钥Key
    secretKey := "xxxx"
    source := "market"

    // 签名
    auth, datetime, _ := calcAuthorization(source, secretId, secretKey)

    // 请求方法
    method := "GET"
    // 请求头
    headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}

    // 查询参数
    queryParams := make(map[string]string)
    queryParams["parentid"] = ""
    // body参数
    bodyParams := make(map[string]string)

    // url参数拼接
    url := "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city"
    if len(queryParams) > 0 {
        url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
    }

    bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
    var body io.Reader = nil
    if bodyMethods[method] {
        body = strings.NewReader(urlencode(bodyParams))
        headers["Content-Type"] = "application/x-www-form-urlencoded"
    }

    client := &http.Client{
        Timeout: 5 * time.Second,
    }
    request, err := http.NewRequest(method, url, body)
    if err != nil {
        panic(err)
    }
    for k, v := range headers {
        request.Header.Set(k, v)
    }
    response, err := client.Do(request)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()

    bodyBytes, err := ioutil.ReadAll(response.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(bodyBytes))
}
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;


public class CsharpTest
{
    public static String HMACSHA1Text(String EncryptText, String EncryptKey)
    {
            HMACSHA1 hmacsha1 = new HMACSHA1();
            hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);

            byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
            byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
            return Convert.ToBase64String(hashBytes);
    }

    public static void Main(String[] args)
    {
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city";
        String method = "GET";
        String querys = "parentid=";
        String source = "market";

        //云市场分配的密钥Id
        String  secretId = "xxx";
        //云市场分配的密钥Key
        String  secretKey = "xxx";

        String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
        url = url + "?" + querys;

        String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
        String sign = HMACSHA1Text(signStr, secretKey);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
        auth = auth + sign + "\"";
        Console.WriteLine(auth + "\n");

        HttpWebRequest httpRequest = null;
        HttpWebResponse httpResponse = null;

        if (url.Contains("https://"))
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
        }
        else
        {
            httpRequest = (HttpWebRequest)WebRequest.Create(url);
        }

        httpRequest.Method = method;
        httpRequest.Headers.Add("Authorization", auth);
        httpRequest.Headers.Add("X-Source", source);
        httpRequest.Headers.Add("X-Date", dt);

        try
        {
            httpResponse = (HttpWebResponse)httpRequest.GetResponse();
        }
        catch (WebException ex)
        {
            httpResponse = (HttpWebResponse)ex.Response;
        }

        Console.WriteLine(httpResponse.StatusCode);
        Console.WriteLine(httpResponse.Headers);
        Stream st = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
        Console.WriteLine(reader.ReadToEnd());
        Console.WriteLine("\n");

    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Encoder;


class Demo {
    public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
            throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
        Mac mac = Mac.getInstance("HmacSHA1");
        Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
        mac.init(sKey);
        byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
        String sig = new BASE64Encoder().encode(hash);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
        return auth;
    }

    public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (sb.length() > 0) {
                sb.append("&");
            }
            sb.append(String.format("%s=%s",
                    URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
                    URLEncoder.encode(entry.getValue().toString(), "UTF-8")
            ));
        }
        return sb.toString();
    }

    public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        //云市场分配的密钥Id
        String secretId = "xxxx";
        //云市场分配的密钥Key
        String secretKey = "xxxx";
        String source = "market";

        Calendar cd = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        String datetime = sdf.format(cd.getTime());
        // 签名
        String auth = calcAuthorization(source, secretId, secretKey, datetime);
        // 请求方法
        String method = "GET";
        // 请求头
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("X-Source", source);
        headers.put("X-Date", datetime);
        headers.put("Authorization", auth);

        // 查询参数
        Map<String, String> queryParams = new HashMap<String, String>();
        queryParams.put("parentid", "");
        // body参数
        Map<String, String> bodyParams = new HashMap<String, String>();

        // url参数拼接
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/city";
        if (!queryParams.isEmpty()) {
            url += "?" + urlencode(queryParams);
        }

        BufferedReader in = null;
        try {
            URL realUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
            conn.setConnectTimeout(5000);
            conn.setReadTimeout(5000);
            conn.setRequestMethod(method);

            // request headers
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                conn.setRequestProperty(entry.getKey(), entry.getValue());
            }

            // request body
            Map<String, Boolean> methods = new HashMap<>();
            methods.put("POST", true);
            methods.put("PUT", true);
            methods.put("PATCH", true);
            Boolean hasBody = methods.get(method);
            if (hasBody != null) {
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

                conn.setDoOutput(true);
                DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                out.writeBytes(urlencode(bodyParams));
                out.flush();
                out.close();
            }

            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String result = "";
            while ((line = in.readLine()) != null) {
                result += line;
            }

            System.out.println(result);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}

正常返回示例

                                                                    {
    "status": 0,
    "msg": "ok",
    "result": [
        {
            "cityid": "1",
            "name": "北京",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "2",
            "name": "安徽",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "3",
            "name": "福建",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "4",
            "name": "甘肃",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "5",
            "name": "广东",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "6",
            "name": "广西",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "7",
            "name": "贵州",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "8",
            "name": "海南",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "9",
            "name": "河北",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "10",
            "name": "河南",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "11",
            "name": "黑龙江",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "12",
            "name": "湖北",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "13",
            "name": "湖南",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "14",
            "name": "吉林",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "15",
            "name": "江苏",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "16",
            "name": "江西",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "17",
            "name": "辽宁",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "18",
            "name": "内蒙古",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "19",
            "name": "宁夏",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "20",
            "name": "青海",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "21",
            "name": "山东",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "22",
            "name": "山西",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "23",
            "name": "陕西",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "24",
            "name": "上海",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "25",
            "name": "四川",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "26",
            "name": "天津",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "27",
            "name": "西藏",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "28",
            "name": "新疆",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "29",
            "name": "云南",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "30",
            "name": "浙江",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "31",
            "name": "重庆",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "32",
            "name": "香港",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "33",
            "name": "澳门",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "34",
            "name": "台湾",
            "parentid": "0",
            "parentname": "",
            "topname": "",
            "depth": "1"
        },
        {
            "cityid": "35",
            "name": "安庆",
            "parentid": "2",
            "parentname": "安徽",
            "topname": "",
            "depth": "2"
        },
        {
            "cityid": "36",
            "name": "蚌埠",
            "parentid": "2",
            "parentname": "安徽",
            "topname": "",
            "depth": "2"
        }
    ]
}
                                                                

返回码定义

返回码
返回信息
描述
201
城市和城市ID为空
202
城市不存在
203
影院ID为空
204
电影ID为空
205
电影ID不存在
206
电影院ID不存在
210
没有信息

按城市获取电影院

调用地址:http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater

请求方式:GET

返回类型:JSON

API调用: API调用说明(secret_id & secret_key)

请求参数(Headers)

名称
类型
是否必须
描述
暂无数据

请求参数(Query)

名称
类型
是否必须
描述
city
string
城市 城市ID和城市任选其一
cityid
string
城市ID
keyword
string
关键词

请求参数(Body)

名称
类型
是否必须
描述
暂无数据

请求示例

# -*- coding: utf-8 -*-
from __future__ import print_function

import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime

try:
    from urllib import urlencode
    from urllib2 import Request, urlopen
except ImportError:
    from urllib.parse import urlencode
    from urllib.request import Request, urlopen

# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"

# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))

# 请求方法
method = 'GET'
# 请求头
headers = {
    'X-Source': source,
    'X-Date': datetime,
    'Authorization': auth,
}
# 查询参数
queryParams = {
    'city': '',
    'cityid': '',
    'keyword': ''}
# body参数(POST方法下存在)
bodyParams = {
}
# url参数拼接
url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater'
if len(queryParams.keys()) > 0:
    url = url + '?' + urlencode(queryParams)

request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
    request.data = urlencode(bodyParams).encode('utf-8')
    request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
    print(content.decode('utf-8'))
curl -v -X GET http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater ?city=&cityid=&keyword=-H 'Host:service-2n6vk134-1257101137.gz.apigw.tencentcs.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest' 
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';

// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);

// 请求方法
$method = 'GET';
// 请求头
$headers = array(
    'X-Source' => $source,
    'X-Date' => $datetime,
    'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
    'city' => '',
    'cityid' => '',
    'keyword' => '',
);
// body参数(POST方法下)
$bodyParams = array (
);
// url参数拼接
$url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater';
if (count($queryParams) > 0) {
    $url .= '?' . http_build_query($queryParams);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
    return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($bodyParams));
}

$data = curl_exec($ch);
if (curl_errno($ch)) {
    echo "Error: " . curl_error($ch);
} else {
    print_r($data);
}
curl_close($ch);
/**
 * npm install crypto-js request
 */
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');

// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";

// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';

// 请求方法
var method = 'GET';
// 请求头
var headers = {
    "X-Source": source,
    "X-Date": datetime,
    "Authorization": auth,
}
// 查询参数
var queryParams = {
    'city': '',
    'cityid': '',
    'keyword': ''}
// body参数(POST方法下)
var bodyParams = {
}
// url参数拼接
var url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater';
if (Object.keys(queryParams).length > 0) {
    url += '?' + querystring.stringify(queryParams);
}

var options = {
    url: url,
    timeout: 5000,
    method: method,
    headers: headers
}
if (['POST', 'PUT', 'PATCH'].indexOf(method) != -1) {
    options['body'] = querystring.stringify(bodyParams);
    options['headers']['Content-Type'] = "application/x-www-form-urlencoded";
}

request(options, function (error, response, body) {
    if (error !== null) {
        console.log('error:', error);
        return;
    }
    console.log(body);
});
package main

import (
    "crypto/hmac"
    "crypto/sha1"
    "encoding/base64"
    "fmt"
    "io"
    "io/ioutil"
    "net/http"
    gourl "net/url"
    "strings"
    "time"
)

func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
    timeLocation, _ := time.LoadLocation("Etc/GMT")
    datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
    signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)

    // hmac-sha1
    mac := hmac.New(sha1.New, []byte(secretKey))
    mac.Write([]byte(signStr))
    sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))

    auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
        secretId, sign)

    return auth, datetime, nil
}

func urlencode(params map[string]string) string {
    var p = gourl.Values{}
    for k, v := range params {
        p.Add(k, v)
    }
    return p.Encode()
}

func main() {
    // 云市场分配的密钥Id
    secretId := "xxxx"
    // 云市场分配的密钥Key
    secretKey := "xxxx"
    source := "market"

    // 签名
    auth, datetime, _ := calcAuthorization(source, secretId, secretKey)

    // 请求方法
    method := "GET"
    // 请求头
    headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}

    // 查询参数
    queryParams := make(map[string]string)
    queryParams["city"] = ""
    queryParams["cityid"] = ""
    queryParams["keyword"] = ""
    // body参数
    bodyParams := make(map[string]string)

    // url参数拼接
    url := "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater"
    if len(queryParams) > 0 {
        url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
    }

    bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
    var body io.Reader = nil
    if bodyMethods[method] {
        body = strings.NewReader(urlencode(bodyParams))
        headers["Content-Type"] = "application/x-www-form-urlencoded"
    }

    client := &http.Client{
        Timeout: 5 * time.Second,
    }
    request, err := http.NewRequest(method, url, body)
    if err != nil {
        panic(err)
    }
    for k, v := range headers {
        request.Header.Set(k, v)
    }
    response, err := client.Do(request)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()

    bodyBytes, err := ioutil.ReadAll(response.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(bodyBytes))
}
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;


public class CsharpTest
{
    public static String HMACSHA1Text(String EncryptText, String EncryptKey)
    {
            HMACSHA1 hmacsha1 = new HMACSHA1();
            hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);

            byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
            byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
            return Convert.ToBase64String(hashBytes);
    }

    public static void Main(String[] args)
    {
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater";
        String method = "GET";
        String querys = "city=&cityid=&keyword=";
        String source = "market";

        //云市场分配的密钥Id
        String  secretId = "xxx";
        //云市场分配的密钥Key
        String  secretKey = "xxx";

        String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
        url = url + "?" + querys;

        String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
        String sign = HMACSHA1Text(signStr, secretKey);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
        auth = auth + sign + "\"";
        Console.WriteLine(auth + "\n");

        HttpWebRequest httpRequest = null;
        HttpWebResponse httpResponse = null;

        if (url.Contains("https://"))
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
        }
        else
        {
            httpRequest = (HttpWebRequest)WebRequest.Create(url);
        }

        httpRequest.Method = method;
        httpRequest.Headers.Add("Authorization", auth);
        httpRequest.Headers.Add("X-Source", source);
        httpRequest.Headers.Add("X-Date", dt);

        try
        {
            httpResponse = (HttpWebResponse)httpRequest.GetResponse();
        }
        catch (WebException ex)
        {
            httpResponse = (HttpWebResponse)ex.Response;
        }

        Console.WriteLine(httpResponse.StatusCode);
        Console.WriteLine(httpResponse.Headers);
        Stream st = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
        Console.WriteLine(reader.ReadToEnd());
        Console.WriteLine("\n");

    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Encoder;


class Demo {
    public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
            throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
        Mac mac = Mac.getInstance("HmacSHA1");
        Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
        mac.init(sKey);
        byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
        String sig = new BASE64Encoder().encode(hash);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
        return auth;
    }

    public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (sb.length() > 0) {
                sb.append("&");
            }
            sb.append(String.format("%s=%s",
                    URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
                    URLEncoder.encode(entry.getValue().toString(), "UTF-8")
            ));
        }
        return sb.toString();
    }

    public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        //云市场分配的密钥Id
        String secretId = "xxxx";
        //云市场分配的密钥Key
        String secretKey = "xxxx";
        String source = "market";

        Calendar cd = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        String datetime = sdf.format(cd.getTime());
        // 签名
        String auth = calcAuthorization(source, secretId, secretKey, datetime);
        // 请求方法
        String method = "GET";
        // 请求头
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("X-Source", source);
        headers.put("X-Date", datetime);
        headers.put("Authorization", auth);

        // 查询参数
        Map<String, String> queryParams = new HashMap<String, String>();
        queryParams.put("city", "");
        queryParams.put("cityid", "");
        queryParams.put("keyword", "");
        // body参数
        Map<String, String> bodyParams = new HashMap<String, String>();

        // url参数拼接
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theater";
        if (!queryParams.isEmpty()) {
            url += "?" + urlencode(queryParams);
        }

        BufferedReader in = null;
        try {
            URL realUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
            conn.setConnectTimeout(5000);
            conn.setReadTimeout(5000);
            conn.setRequestMethod(method);

            // request headers
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                conn.setRequestProperty(entry.getKey(), entry.getValue());
            }

            // request body
            Map<String, Boolean> methods = new HashMap<>();
            methods.put("POST", true);
            methods.put("PUT", true);
            methods.put("PATCH", true);
            Boolean hasBody = methods.get(method);
            if (hasBody != null) {
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

                conn.setDoOutput(true);
                DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                out.writeBytes(urlencode(bodyParams));
                out.flush();
                out.close();
            }

            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String result = "";
            while ((line = in.readLine()) != null) {
                result += line;
            }

            System.out.println(result);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}

正常返回示例

                                                                    {
    "status": 0,
    "msg": "ok",
    "result": {
        "city": "杭州",
        "cityid": "382",
        "keyword": "",
        "list": [
            {
                "theaterid": "1583",
                "theatername": "富阳时代电影大世界",
                "cityid": "3238",
                "tel": "0571-61711166",
                "address": "富阳市龙山路126号(三小对面)",
                "hours": "09:00-",
                "seatnum": "730",
                "roomnum": "6",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/1583.jpg",
                "score": "8.529593",
                "summary": "富阳时代电影大世界座位于富阳市富阳市心北路,物美超市四楼,周边学校、商铺众多,业态丰富,极具人气。富阳时代电影大世界是浙江时代电影大世界旗下第15家时代电影大世界品牌影院,总投资1000余万元,影院共设6个放映小厅、730个座位,每个小厅有50—100个座位,40万元一台的数字电影放映机共6套。     富阳电影大世界在原有各时代影院的基础上又有所突破、更具时尚和流行气息。影院大厅宽敞开阔,大厅内明星墙配以柔和变幻的灯光,彰显出百年电影历史时空中的熠熠星光。匠心独具的座椅让等候观影的顾客可静坐小憩,多块LED中播放的电影预告,让观众可以尽情欣赏电影预告片的精彩片段,同时先进的电子售票系统也能让观众直观地选择观影座位,整个影院内部环境温馨、格调高雅。     观影厅内采用SR.D、DTS国际先进数码还音,弧型超大银幕和先进放映设备,德国进口专业镜头、美国进口JBL音响,保障精美绝伦的声画呈现,让您领略惊天动地、排山倒海的震撼以及细致入微的变化。座位阶梯式排列,每个观众都能毫无遮挡地欣赏电影。宽大带头枕的新型座椅,加之扶",
                "lat": "30.05239",
                "lng": "119.95920",
                "city": "富阳区"
            },
            {
                "theaterid": "1584",
                "theatername": "横店电影城(富阳店)",
                "cityid": "3238",
                "tel": "0571-61717332",
                "address": "浙江省杭州富阳春秋北路271号",
                "hours": "09:00-24:00",
                "seatnum": "700",
                "roomnum": "5",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/1584.jpg",
                "score": "7.083036",
                "summary": "横店影视电影有限公司位于集购物、休闲、娱乐为一体的玉长城南区四楼,是由横店集团浙江横店影视娱乐有限公司投资兴建的一家豪华多功能影城。         影城面积2800平方米,建有4个一流的专业影厅和1个豪华VIP厅,可容纳700余名观众。影厅配置当今高档的视听设备:美国JBL功放和音响,英国DOLBY数字解码器,德国进口高清晰放映镜头,英国哈尼克斯高反射率银幕。高品质清晰画面给您带来超值的视觉享受,让您身临其境,流连忘返,享受从未有过的视听震撼!影城按照国际影院高标准设计,通道式入厅长廊可让观众快速找到观影厅。影厅内不仅安装了超大的整壁式清晰银幕、超宽沙发式座椅,还采用了45度角阶梯设计,进一步提高了视觉效果,让观众充分享受星级服务。固定式豪华超宽带摇摆式座椅,可调节,可摆动,每排间隔达到1.2米,高度起坡达到了30厘米,两座位间宽距达到了58厘米,超大的间距保证了每位观众完美的观影视角。影城售票大厅宽敞明亮,先进的售票系统,品种丰富的卖品,无障碍的残疾人专用通道,尽显人性化的设计及国际影院的气派。 &nb",
                "lat": "30.05999",
                "lng": "119.94250",
                "city": "富阳区"
            },
            {
                "theaterid": "2005",
                "theatername": "星美国际影商城(临安影视城店)",
                "cityid": "3239",
                "tel": "0571-63721902",
                "address": "锦城街道天目路322号临安影视城三楼",
                "hours": "09:00-02:00",
                "seatnum": "706",
                "roomnum": "6",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2005.jpg",
                "score": "7.403008",
                "summary": "准三星级影院设计建造,拥有大众厅、数码厅、豪华厅、钻石厅等大、中、小五只电影厅。 人性化服务,看电影,象家里一样温馨! 全天滚动上映3-5部中外新影片,随到随看,自由选片! 全部采用国际标准立体声还音系统,高靠豪华坐椅,低视点无阻挡观影,高清晰度大电影,震撼音效,超级享受,无与伦比!",
                "lat": "30.23156",
                "lng": "119.72550",
                "city": "临安市"
            },
            {
                "theaterid": "2006",
                "theatername": "中影M-17影城",
                "cityid": "3238",
                "tel": "0571-61768000",
                "address": "浙江省杭州市富阳区育才西路1001号",
                "hours": "9:00~00:00-",
                "seatnum": "541",
                "roomnum": "8",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2006.jpg",
                "score": "0",
                "summary": "",
                "lat": "0.00000",
                "lng": "0.00000",
                "city": "富阳区"
            },
            {
                "theaterid": "2007",
                "theatername": "星美国际影商城(杭州富阳新晨店)",
                "cityid": "3238",
                "tel": "0571-63251118",
                "address": "杭州市富阳区新登镇金城路103号",
                "hours": "10:00-24:00",
                "seatnum": "596",
                "roomnum": "4",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2007.jpg",
                "score": "0",
                "summary": "新登影院,富阳及桐庐地区巨幕厅,16米超宽银幕畅享电影生活",
                "lat": "29.97881",
                "lng": "119.73940",
                "city": "富阳区"
            },
            {
                "theaterid": "2008",
                "theatername": "金逸杭州北城天地店",
                "cityid": "3231",
                "tel": "0571-87897930",
                "address": "拱墅区湖州街567号北城天地商业广场4F",
                "hours": "10:00-22:50 ",
                "seatnum": "1200",
                "roomnum": "6",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2008.jpg",
                "score": "7.925398",
                "summary": "金逸杭州【北城天地店】位于拱墅区湖州街567号北城天地商业广场4F,拥有6个专业影厅,包括一个双机数字影厅、一个VIP厅以及一个巨幕厅,1164个舒适座位,是杭州北部功能齐全的影城,既是城北都市白领、精英家庭休闲聚会的场所,更是城北居民放松心情、品味生活的电影家园。金逸杭州【北城天地店】,秉持“电影航母,科技缔造视听新感觉”和“展现电影魅力,·传播电影文化”的经营理念,引入细微、舒适的人性化服务及连锁影院成功管理模式,未来将与【金逸杭州南宋御街店】、【金逸杭州天虹购物中心店】、【金逸杭州影视中心店】形成四家连锁的联合效应,为观众带来舒适的观影感受,为华语电影事业的发展增光添彩!金逸杭州【北城天地店】精心打造属于您的电影空间!",
                "lat": "30.32097",
                "lng": "120.12220",
                "city": "拱墅区"
            },
            {
                "theaterid": "2009",
                "theatername": "杭州拱墅万达广场店",
                "cityid": "3231",
                "tel": "0571-28201888",
                "address": "杭州市拱墅区杭行路666号万达广场4楼",
                "hours": "10:00-22:00",
                "seatnum": "1975",
                "roomnum": "11",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2009.jpg",
                "score": "9.609528",
                "summary": "万达电影院线成立于2005年,隶属于万达集团。是亚洲银幕数排名前列的电影院线。目前是国内拥有IMAX银幕数较多的院线。 万达广场店,是万达院线入驻杭州的五星级影院,万达广场店11个影厅,拥有一个IMAX厅,一个VIP厅,其他为RealD影厅,影厅全面安装进口数字放映系统、音响系统和银幕从工艺上保证观影品质。",
                "lat": "30.32928",
                "lng": "120.11830",
                "city": "拱墅区"
            },
            {
                "theaterid": "2010",
                "theatername": "杭州万达影城水晶城店",
                "cityid": "3231",
                "tel": "",
                "address": "杭州市拱墅区上塘路458号水晶城购物中心7楼",
                "hours": "",
                "seatnum": "1220",
                "roomnum": "8",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2010.jpg",
                "score": "8.957146",
                "summary": "",
                "lat": "30.30381",
                "lng": "120.15180",
                "city": "拱墅区"
            },
            {
                "theaterid": "2012",
                "theatername": "杭州传奇奢华影城",
                "cityid": "3231",
                "tel": "0571-88222929",
                "address": "杭州市拱墅区丰潭路380号银泰城4楼",
                "hours": "10:00-22:30",
                "seatnum": "2000",
                "roomnum": "12",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2012.jpg",
                "score": "7.232035",
                "summary": "杭州传奇奢华影城是杭城新建立的五星级影城,位于银泰城4楼,影城总面积8000平米,共有12个放映厅,总计2000多个座位,分为会员区与非会员区。影城拥有超亮4K双机“中国巨幕”影厅,2个豪华VIP厅,富有创意的家庭儿童观影区,影城还有会员独享的幽雅会员休息区,影院创意餐厅、水吧区、SAGA COFFEE品牌咖啡厅等周全服务设施。我们希望呈现给观众的不仅是好的视听效果,更是一种享受电影的生活方式。更多信息请关注@杭州传奇奢华影城",
                "lat": "30.29923",
                "lng": "120.10860",
                "city": "拱墅区"
            },
            {
                "theaterid": "2013",
                "theatername": "杭州金象影城",
                "cityid": "3231",
                "tel": "0571-86558333",
                "address": "杭州市登云路518号",
                "hours": "09:00-23:00",
                "seatnum": "1500",
                "roomnum": "11",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2013.jpg",
                "score": "8.893507",
                "summary": "浙江时代院线旗下的杭州金象影城是按国际五星级影院标准设计结合艺术展览的公共品质空间。金象影城有11个电影厅,影厅全部采用目前国际上先进的数字电影放映还音设备、3D偏振系统。主动细致的礼貌服务让观众体验尊贵和亲切,网上订购票、自动售票、自动检票等高新技术也将在影城为观众提供服务。 杭州金象影城将以优惠的票价让更多人走进影院享受文化生活,使“看电影”不再是奢侈的文化娱乐活动,让更多杭州市民享受文化体制改革带来的胜利成果。金象影城将不定期举办艺术品展、摄影展等各类文化活动,让市民到杭州金象影城不仅仅是看电影,还会是一次特别的文化活动体验。杭州金象影城是融电影、艺术、音乐、文化展示于一体的公共休闲活动空间,是国内引领差异化多元化经营的文化创意影城,是广大人民群众享受经典艺术、享有公共文化服务的高雅场所。电影让生活更精彩!影城让杭州更具魅力!",
                "lat": "30.29747",
                "lng": "120.11760",
                "city": "拱墅区"
            },
            {
                "theaterid": "2014",
                "theatername": "杭州光影影院",
                "cityid": "3231",
                "tel": "0571-88092209",
                "address": "杭州市湖墅南路103号百大花园裙楼三楼、四楼(湖墅南路与文晖路交叉口、星都宾馆对面)",
                "hours": "10:00-22:30",
                "seatnum": "934",
                "roomnum": "11",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2014.jpg",
                "score": "8.430662",
                "summary": "杭州光影影城位于杭州市文晖路与湖墅南路交叉口百大花园裙楼三楼·四楼,拥有11个数字化电影放映厅,包含10个3D影厅。集休闲、娱乐、美食于一体,休息大厅宽敞别致,设有小型自助超市。影城网络订票服务能预先订票、购票,走进杭州光影影城,挑选一部精彩影片,享受一次视听盛宴。",
                "lat": "30.27825",
                "lng": "120.15450",
                "city": "拱墅区"
            },
            {
                "theaterid": "2015",
                "theatername": "杭州比高电影城(大河店)",
                "cityid": "3231",
                "tel": "0571-28066699",
                "address": "杭州市拱墅区小河路488号运河天地4幢",
                "hours": "09:30-22:30",
                "seatnum": "1313",
                "roomnum": "10",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2015.jpg",
                "score": "8.723612",
                "summary": "比高电影院是由周星驰旗下的香港比高集团投资的一家影院,影城坐落在杭州拱墅区运河天地(原大河造船厂)临近拱宸桥、拱墅区政府,杭州比高影城为比高集团在杭州投资的一家店,在未来一年内杭州将有多家比高影院陆续建成。我们影城建筑面积3000平方米,拥有10个放映厅,其中有7个为3D影厅,共1300多个座位。杭州比高电影城将以“品质、服务、价格”为核心,以“让电影回归大众”为理念,力争为杭州观众带来更高品质的影视视听享受。",
                "lat": "30.32577",
                "lng": "120.13770",
                "city": "拱墅区"
            }
        ]
    }
}
                                                                

返回码定义

返回码
返回信息
描述
201
城市和城市ID为空
202
城市不存在
203
影院ID为空
204
电影ID为空
205
电影ID不存在
206
电影院ID不存在
210
没有信息

电影详情

调用地址:http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail

请求方式:GET

返回类型:JSON

API调用: API调用说明(secret_id & secret_key)

请求参数(Headers)

名称
类型
是否必须
描述
暂无数据

请求参数(Query)

名称
类型
是否必须
描述
movieid
string
电影ID
moviename
string
电影名称 和电影ID任选其一

请求参数(Body)

名称
类型
是否必须
描述
暂无数据

请求示例

# -*- coding: utf-8 -*-
from __future__ import print_function

import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime

try:
    from urllib import urlencode
    from urllib2 import Request, urlopen
except ImportError:
    from urllib.parse import urlencode
    from urllib.request import Request, urlopen

# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"

# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))

# 请求方法
method = 'GET'
# 请求头
headers = {
    'X-Source': source,
    'X-Date': datetime,
    'Authorization': auth,
}
# 查询参数
queryParams = {
    'movieid': '',
    'moviename': ''}
# body参数(POST方法下存在)
bodyParams = {
}
# url参数拼接
url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail'
if len(queryParams.keys()) > 0:
    url = url + '?' + urlencode(queryParams)

request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
    request.data = urlencode(bodyParams).encode('utf-8')
    request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
    print(content.decode('utf-8'))
curl -v -X GET http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail ?movieid=&moviename=-H 'Host:service-2n6vk134-1257101137.gz.apigw.tencentcs.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest' 
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';

// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);

// 请求方法
$method = 'GET';
// 请求头
$headers = array(
    'X-Source' => $source,
    'X-Date' => $datetime,
    'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
    'movieid' => '',
    'moviename' => '',
);
// body参数(POST方法下)
$bodyParams = array (
);
// url参数拼接
$url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail';
if (count($queryParams) > 0) {
    $url .= '?' . http_build_query($queryParams);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
    return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($bodyParams));
}

$data = curl_exec($ch);
if (curl_errno($ch)) {
    echo "Error: " . curl_error($ch);
} else {
    print_r($data);
}
curl_close($ch);
/**
 * npm install crypto-js request
 */
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');

// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";

// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';

// 请求方法
var method = 'GET';
// 请求头
var headers = {
    "X-Source": source,
    "X-Date": datetime,
    "Authorization": auth,
}
// 查询参数
var queryParams = {
    'movieid': '',
    'moviename': ''}
// body参数(POST方法下)
var bodyParams = {
}
// url参数拼接
var url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail';
if (Object.keys(queryParams).length > 0) {
    url += '?' + querystring.stringify(queryParams);
}

var options = {
    url: url,
    timeout: 5000,
    method: method,
    headers: headers
}
if (['POST', 'PUT', 'PATCH'].indexOf(method) != -1) {
    options['body'] = querystring.stringify(bodyParams);
    options['headers']['Content-Type'] = "application/x-www-form-urlencoded";
}

request(options, function (error, response, body) {
    if (error !== null) {
        console.log('error:', error);
        return;
    }
    console.log(body);
});
package main

import (
    "crypto/hmac"
    "crypto/sha1"
    "encoding/base64"
    "fmt"
    "io"
    "io/ioutil"
    "net/http"
    gourl "net/url"
    "strings"
    "time"
)

func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
    timeLocation, _ := time.LoadLocation("Etc/GMT")
    datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
    signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)

    // hmac-sha1
    mac := hmac.New(sha1.New, []byte(secretKey))
    mac.Write([]byte(signStr))
    sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))

    auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
        secretId, sign)

    return auth, datetime, nil
}

func urlencode(params map[string]string) string {
    var p = gourl.Values{}
    for k, v := range params {
        p.Add(k, v)
    }
    return p.Encode()
}

func main() {
    // 云市场分配的密钥Id
    secretId := "xxxx"
    // 云市场分配的密钥Key
    secretKey := "xxxx"
    source := "market"

    // 签名
    auth, datetime, _ := calcAuthorization(source, secretId, secretKey)

    // 请求方法
    method := "GET"
    // 请求头
    headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}

    // 查询参数
    queryParams := make(map[string]string)
    queryParams["movieid"] = ""
    queryParams["moviename"] = ""
    // body参数
    bodyParams := make(map[string]string)

    // url参数拼接
    url := "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail"
    if len(queryParams) > 0 {
        url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
    }

    bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
    var body io.Reader = nil
    if bodyMethods[method] {
        body = strings.NewReader(urlencode(bodyParams))
        headers["Content-Type"] = "application/x-www-form-urlencoded"
    }

    client := &http.Client{
        Timeout: 5 * time.Second,
    }
    request, err := http.NewRequest(method, url, body)
    if err != nil {
        panic(err)
    }
    for k, v := range headers {
        request.Header.Set(k, v)
    }
    response, err := client.Do(request)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()

    bodyBytes, err := ioutil.ReadAll(response.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(bodyBytes))
}
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;


public class CsharpTest
{
    public static String HMACSHA1Text(String EncryptText, String EncryptKey)
    {
            HMACSHA1 hmacsha1 = new HMACSHA1();
            hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);

            byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
            byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
            return Convert.ToBase64String(hashBytes);
    }

    public static void Main(String[] args)
    {
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail";
        String method = "GET";
        String querys = "movieid=&moviename=";
        String source = "market";

        //云市场分配的密钥Id
        String  secretId = "xxx";
        //云市场分配的密钥Key
        String  secretKey = "xxx";

        String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
        url = url + "?" + querys;

        String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
        String sign = HMACSHA1Text(signStr, secretKey);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
        auth = auth + sign + "\"";
        Console.WriteLine(auth + "\n");

        HttpWebRequest httpRequest = null;
        HttpWebResponse httpResponse = null;

        if (url.Contains("https://"))
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
        }
        else
        {
            httpRequest = (HttpWebRequest)WebRequest.Create(url);
        }

        httpRequest.Method = method;
        httpRequest.Headers.Add("Authorization", auth);
        httpRequest.Headers.Add("X-Source", source);
        httpRequest.Headers.Add("X-Date", dt);

        try
        {
            httpResponse = (HttpWebResponse)httpRequest.GetResponse();
        }
        catch (WebException ex)
        {
            httpResponse = (HttpWebResponse)ex.Response;
        }

        Console.WriteLine(httpResponse.StatusCode);
        Console.WriteLine(httpResponse.Headers);
        Stream st = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
        Console.WriteLine(reader.ReadToEnd());
        Console.WriteLine("\n");

    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Encoder;


class Demo {
    public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
            throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
        Mac mac = Mac.getInstance("HmacSHA1");
        Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
        mac.init(sKey);
        byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
        String sig = new BASE64Encoder().encode(hash);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
        return auth;
    }

    public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (sb.length() > 0) {
                sb.append("&");
            }
            sb.append(String.format("%s=%s",
                    URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
                    URLEncoder.encode(entry.getValue().toString(), "UTF-8")
            ));
        }
        return sb.toString();
    }

    public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        //云市场分配的密钥Id
        String secretId = "xxxx";
        //云市场分配的密钥Key
        String secretKey = "xxxx";
        String source = "market";

        Calendar cd = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        String datetime = sdf.format(cd.getTime());
        // 签名
        String auth = calcAuthorization(source, secretId, secretKey, datetime);
        // 请求方法
        String method = "GET";
        // 请求头
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("X-Source", source);
        headers.put("X-Date", datetime);
        headers.put("Authorization", auth);

        // 查询参数
        Map<String, String> queryParams = new HashMap<String, String>();
        queryParams.put("movieid", "");
        queryParams.put("moviename", "");
        // body参数
        Map<String, String> bodyParams = new HashMap<String, String>();

        // url参数拼接
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/detail";
        if (!queryParams.isEmpty()) {
            url += "?" + urlencode(queryParams);
        }

        BufferedReader in = null;
        try {
            URL realUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
            conn.setConnectTimeout(5000);
            conn.setReadTimeout(5000);
            conn.setRequestMethod(method);

            // request headers
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                conn.setRequestProperty(entry.getKey(), entry.getValue());
            }

            // request body
            Map<String, Boolean> methods = new HashMap<>();
            methods.put("POST", true);
            methods.put("PUT", true);
            methods.put("PATCH", true);
            Boolean hasBody = methods.get(method);
            if (hasBody != null) {
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

                conn.setDoOutput(true);
                DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                out.writeBytes(urlencode(bodyParams));
                out.flush();
                out.close();
            }

            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String result = "";
            while ((line = in.readLine()) != null) {
                result += line;
            }

            System.out.println(result);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}

正常返回示例

                                                                    {
    "status": 0,
    "msg": "ok",
    "result": {
        "moviename": "盗梦空间",
        "movieid": "14",
        "enname": "Inception",
        "pic": "http://api.jisuapi.com/movie/upload/movie/1/14.jpg",
        "class": "动作 冒险 科幻",
        "year": "2010",
        "releasedate": "2010-09-01",
        "country": "美国",
        "director": "克里斯托弗·诺兰",
        "actor": "",
        "screenwriter": "克里斯托弗·诺兰",
        "publisher": "华纳兄弟影片公司",
        "summary": "",
        "screentype": "2D/IMAX",
        "duration": "148分钟"
    }
}
                                                                

返回码定义

返回码
返回信息
描述
201
城市和城市ID为空
202
城市不存在
203
影院ID为空
204
电影ID为空
205
电影ID不存在
206
电影院ID不存在
210
没有信息

电影院放映的电影

调用地址:http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie

请求方式:GET

返回类型:JSON

API调用: API调用说明(secret_id & secret_key)

请求参数(Headers)

名称
类型
是否必须
描述
暂无数据

请求参数(Query)

名称
类型
是否必须
描述
date
string
日期 默认当天
theaterid
string
电影院ID

请求参数(Body)

名称
类型
是否必须
描述
暂无数据

请求示例

# -*- coding: utf-8 -*-
from __future__ import print_function

import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime

try:
    from urllib import urlencode
    from urllib2 import Request, urlopen
except ImportError:
    from urllib.parse import urlencode
    from urllib.request import Request, urlopen

# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"

# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))

# 请求方法
method = 'GET'
# 请求头
headers = {
    'X-Source': source,
    'X-Date': datetime,
    'Authorization': auth,
}
# 查询参数
queryParams = {
    'date': '',
    'theaterid': ''}
# body参数(POST方法下存在)
bodyParams = {
}
# url参数拼接
url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie'
if len(queryParams.keys()) > 0:
    url = url + '?' + urlencode(queryParams)

request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
    request.data = urlencode(bodyParams).encode('utf-8')
    request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
    print(content.decode('utf-8'))
curl -v -X GET http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie ?date=&theaterid=-H 'Host:service-2n6vk134-1257101137.gz.apigw.tencentcs.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest' 
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';

// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);

// 请求方法
$method = 'GET';
// 请求头
$headers = array(
    'X-Source' => $source,
    'X-Date' => $datetime,
    'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
    'date' => '',
    'theaterid' => '',
);
// body参数(POST方法下)
$bodyParams = array (
);
// url参数拼接
$url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie';
if (count($queryParams) > 0) {
    $url .= '?' . http_build_query($queryParams);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
    return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($bodyParams));
}

$data = curl_exec($ch);
if (curl_errno($ch)) {
    echo "Error: " . curl_error($ch);
} else {
    print_r($data);
}
curl_close($ch);
/**
 * npm install crypto-js request
 */
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');

// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";

// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';

// 请求方法
var method = 'GET';
// 请求头
var headers = {
    "X-Source": source,
    "X-Date": datetime,
    "Authorization": auth,
}
// 查询参数
var queryParams = {
    'date': '',
    'theaterid': ''}
// body参数(POST方法下)
var bodyParams = {
}
// url参数拼接
var url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie';
if (Object.keys(queryParams).length > 0) {
    url += '?' + querystring.stringify(queryParams);
}

var options = {
    url: url,
    timeout: 5000,
    method: method,
    headers: headers
}
if (['POST', 'PUT', 'PATCH'].indexOf(method) != -1) {
    options['body'] = querystring.stringify(bodyParams);
    options['headers']['Content-Type'] = "application/x-www-form-urlencoded";
}

request(options, function (error, response, body) {
    if (error !== null) {
        console.log('error:', error);
        return;
    }
    console.log(body);
});
package main

import (
    "crypto/hmac"
    "crypto/sha1"
    "encoding/base64"
    "fmt"
    "io"
    "io/ioutil"
    "net/http"
    gourl "net/url"
    "strings"
    "time"
)

func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
    timeLocation, _ := time.LoadLocation("Etc/GMT")
    datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
    signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)

    // hmac-sha1
    mac := hmac.New(sha1.New, []byte(secretKey))
    mac.Write([]byte(signStr))
    sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))

    auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
        secretId, sign)

    return auth, datetime, nil
}

func urlencode(params map[string]string) string {
    var p = gourl.Values{}
    for k, v := range params {
        p.Add(k, v)
    }
    return p.Encode()
}

func main() {
    // 云市场分配的密钥Id
    secretId := "xxxx"
    // 云市场分配的密钥Key
    secretKey := "xxxx"
    source := "market"

    // 签名
    auth, datetime, _ := calcAuthorization(source, secretId, secretKey)

    // 请求方法
    method := "GET"
    // 请求头
    headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}

    // 查询参数
    queryParams := make(map[string]string)
    queryParams["date"] = ""
    queryParams["theaterid"] = ""
    // body参数
    bodyParams := make(map[string]string)

    // url参数拼接
    url := "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie"
    if len(queryParams) > 0 {
        url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
    }

    bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
    var body io.Reader = nil
    if bodyMethods[method] {
        body = strings.NewReader(urlencode(bodyParams))
        headers["Content-Type"] = "application/x-www-form-urlencoded"
    }

    client := &http.Client{
        Timeout: 5 * time.Second,
    }
    request, err := http.NewRequest(method, url, body)
    if err != nil {
        panic(err)
    }
    for k, v := range headers {
        request.Header.Set(k, v)
    }
    response, err := client.Do(request)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()

    bodyBytes, err := ioutil.ReadAll(response.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(bodyBytes))
}
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;


public class CsharpTest
{
    public static String HMACSHA1Text(String EncryptText, String EncryptKey)
    {
            HMACSHA1 hmacsha1 = new HMACSHA1();
            hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);

            byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
            byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
            return Convert.ToBase64String(hashBytes);
    }

    public static void Main(String[] args)
    {
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie";
        String method = "GET";
        String querys = "date=&theaterid=";
        String source = "market";

        //云市场分配的密钥Id
        String  secretId = "xxx";
        //云市场分配的密钥Key
        String  secretKey = "xxx";

        String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
        url = url + "?" + querys;

        String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
        String sign = HMACSHA1Text(signStr, secretKey);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
        auth = auth + sign + "\"";
        Console.WriteLine(auth + "\n");

        HttpWebRequest httpRequest = null;
        HttpWebResponse httpResponse = null;

        if (url.Contains("https://"))
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
        }
        else
        {
            httpRequest = (HttpWebRequest)WebRequest.Create(url);
        }

        httpRequest.Method = method;
        httpRequest.Headers.Add("Authorization", auth);
        httpRequest.Headers.Add("X-Source", source);
        httpRequest.Headers.Add("X-Date", dt);

        try
        {
            httpResponse = (HttpWebResponse)httpRequest.GetResponse();
        }
        catch (WebException ex)
        {
            httpResponse = (HttpWebResponse)ex.Response;
        }

        Console.WriteLine(httpResponse.StatusCode);
        Console.WriteLine(httpResponse.Headers);
        Stream st = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
        Console.WriteLine(reader.ReadToEnd());
        Console.WriteLine("\n");

    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Encoder;


class Demo {
    public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
            throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
        Mac mac = Mac.getInstance("HmacSHA1");
        Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
        mac.init(sKey);
        byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
        String sig = new BASE64Encoder().encode(hash);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
        return auth;
    }

    public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (sb.length() > 0) {
                sb.append("&");
            }
            sb.append(String.format("%s=%s",
                    URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
                    URLEncoder.encode(entry.getValue().toString(), "UTF-8")
            ));
        }
        return sb.toString();
    }

    public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        //云市场分配的密钥Id
        String secretId = "xxxx";
        //云市场分配的密钥Key
        String secretKey = "xxxx";
        String source = "market";

        Calendar cd = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        String datetime = sdf.format(cd.getTime());
        // 签名
        String auth = calcAuthorization(source, secretId, secretKey, datetime);
        // 请求方法
        String method = "GET";
        // 请求头
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("X-Source", source);
        headers.put("X-Date", datetime);
        headers.put("Authorization", auth);

        // 查询参数
        Map<String, String> queryParams = new HashMap<String, String>();
        queryParams.put("date", "");
        queryParams.put("theaterid", "");
        // body参数
        Map<String, String> bodyParams = new HashMap<String, String>();

        // url参数拼接
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/theatermovie";
        if (!queryParams.isEmpty()) {
            url += "?" + urlencode(queryParams);
        }

        BufferedReader in = null;
        try {
            URL realUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
            conn.setConnectTimeout(5000);
            conn.setReadTimeout(5000);
            conn.setRequestMethod(method);

            // request headers
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                conn.setRequestProperty(entry.getKey(), entry.getValue());
            }

            // request body
            Map<String, Boolean> methods = new HashMap<>();
            methods.put("POST", true);
            methods.put("PUT", true);
            methods.put("PATCH", true);
            Boolean hasBody = methods.get(method);
            if (hasBody != null) {
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

                conn.setDoOutput(true);
                DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                out.writeBytes(urlencode(bodyParams));
                out.flush();
                out.close();
            }

            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String result = "";
            while ((line = in.readLine()) != null) {
                result += line;
            }

            System.out.println(result);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}

正常返回示例

                                                                    {
    "status": 0,
    "msg": "ok",
    "result": {
        "theaterid": "2059",
        "date": "2018-07-08",
        "theatername": "海上明珠国际影城西湖店",
        "city": "上城区",
        "cityid": "3229",
        "lat": "30.24329",
        "lng": "120.1662",
        "num": "12",
        "list": [
            {
                "enname": "Dying To Survive",
                "director": "文牧野",
                "actor": "徐峥 周一围",
                "duration": "116",
                "class": "剧情 喜剧",
                "year": "2018",
                "movieid": "137363",
                "moviename": "我不是药神",
                "showlist": [
                    {
                        "starttime": "19:30",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计21:26散场",
                        "hallname": "7号厅",
                        "seatnum": "54",
                        "issale": "",
                        "originalprice": "",
                        "price": "0",
                        "ticketurl": ""
                    },
                    {
                        "starttime": "19:50",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计21:46散场",
                        "hallname": "6号厅",
                        "seatnum": "85",
                        "issale": "1",
                        "originalprice": "",
                        "price": "43",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1832777574/"
                    },
                    {
                        "starttime": "20:05",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计22:01散场",
                        "hallname": "4号厅",
                        "seatnum": "101",
                        "issale": "1",
                        "originalprice": "",
                        "price": "43",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1833809411/"
                    },
                    {
                        "starttime": "20:15",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计22:11散场",
                        "hallname": "格瓦拉厅",
                        "seatnum": "102",
                        "issale": "1",
                        "originalprice": "",
                        "price": "43",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1832990851/"
                    },
                    {
                        "starttime": "20:20",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计22:16散场",
                        "hallname": "3号厅",
                        "seatnum": "118",
                        "issale": "1",
                        "originalprice": "",
                        "price": "43",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1832777553/"
                    },
                    {
                        "starttime": "20:40",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计22:36散场",
                        "hallname": "1号厅",
                        "seatnum": "140",
                        "issale": "1",
                        "originalprice": "",
                        "price": "43",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1831847788/"
                    },
                    {
                        "starttime": "21:25",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计23:21散场",
                        "hallname": "2号厅",
                        "seatnum": "140",
                        "issale": "1",
                        "originalprice": "",
                        "price": "38",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1832777551/"
                    },
                    {
                        "starttime": "22:05",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计00:01散场",
                        "hallname": "6号厅",
                        "seatnum": "85",
                        "issale": "1",
                        "originalprice": "",
                        "price": "38",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1831847798/"
                    },
                    {
                        "starttime": "22:30",
                        "screentype": "2D",
                        "language": "中文版",
                        "endtime": "预计00:26散场",
                        "hallname": "格瓦拉厅",
                        "seatnum": "102",
                        "issale": "1",
                        "originalprice": "",
                        "price": "38",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1832990852/"
                    }
                ]
            },
            {
                "enname": "Animal World",
                "director": "韩延",
                "actor": "李易峰 迈克尔·道格拉斯",
                "duration": "132分钟",
                "class": "动作 剧情 悬疑",
                "year": "2018",
                "movieid": "137197",
                "moviename": "动物世界",
                "showlist": [
                    {
                        "starttime": "21:45",
                        "screentype": "3D",
                        "language": "中文版",
                        "endtime": "预计23:57散场",
                        "hallname": "7号厅",
                        "seatnum": "54",
                        "issale": "1",
                        "originalprice": "",
                        "price": "38",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1831847803/"
                    }
                ]
            },
            {
                "enname": "Jurassic World: Fallen Kingdom",
                "director": "胡安·安东尼奥·巴亚纳",
                "actor": "克里斯·帕拉特 布莱丝·达拉斯·霍华德",
                "duration": "128分钟",
                "class": "动作 冒险 科幻",
                "year": "2018",
                "movieid": "17594",
                "moviename": "侏罗纪世界2",
                "showlist": [
                    {
                        "starttime": "22:15",
                        "screentype": "3D",
                        "language": "",
                        "endtime": "预计00:23散场",
                        "hallname": "4号厅",
                        "seatnum": "101",
                        "issale": "1",
                        "originalprice": "",
                        "price": "38",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1833942451/"
                    }
                ]
            },
            {
                "enname": "The Incredibles 2",
                "director": "布拉德·伯德",
                "actor": "格雷格·T·尼尔森 霍利·亨特",
                "duration": "126分钟(含贴片)|118分钟",
                "class": "动画 动作 冒险 喜剧 家庭 科幻",
                "year": "2018",
                "movieid": "8702",
                "moviename": "超人总动员2",
                "showlist": [
                    {
                        "starttime": "22:40",
                        "screentype": "3D",
                        "language": "英文版",
                        "endtime": "预计00:46散场",
                        "hallname": "3号厅",
                        "seatnum": "118",
                        "issale": "1",
                        "originalprice": "",
                        "price": "38",
                        "ticketurl": "http://piao.mtime.com/onlineticket/showtime/1832990849/"
                    }
                ]
            }
        ]
    }
}
                                                                

返回码定义

返回码
返回信息
描述
201
城市和城市ID为空
202
城市不存在
203
影院ID为空
204
电影ID为空
205
电影ID不存在
206
电影院ID不存在
210
没有信息

电影放映的电影院

调用地址:http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater

请求方式:GET

返回类型:JSON

API调用: API调用说明(secret_id & secret_key)

请求参数(Headers)

名称
类型
是否必须
描述
暂无数据

请求参数(Query)

名称
类型
是否必须
描述
city
string
城市 城市ID和城市任选其一
cityid
string
城市ID
date
string
日期 默认当天
movieid
string
电影ID

请求参数(Body)

名称
类型
是否必须
描述
暂无数据

请求示例

# -*- coding: utf-8 -*-
from __future__ import print_function

import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime

try:
    from urllib import urlencode
    from urllib2 import Request, urlopen
except ImportError:
    from urllib.parse import urlencode
    from urllib.request import Request, urlopen

# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"

# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))

# 请求方法
method = 'GET'
# 请求头
headers = {
    'X-Source': source,
    'X-Date': datetime,
    'Authorization': auth,
}
# 查询参数
queryParams = {
    'city': '',
    'cityid': '',
    'date': '',
    'movieid': ''}
# body参数(POST方法下存在)
bodyParams = {
}
# url参数拼接
url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater'
if len(queryParams.keys()) > 0:
    url = url + '?' + urlencode(queryParams)

request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
    request.data = urlencode(bodyParams).encode('utf-8')
    request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
    print(content.decode('utf-8'))
curl -v -X GET http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater ?city=&cityid=&date=&movieid=-H 'Host:service-2n6vk134-1257101137.gz.apigw.tencentcs.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest' 
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';

// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);

// 请求方法
$method = 'GET';
// 请求头
$headers = array(
    'X-Source' => $source,
    'X-Date' => $datetime,
    'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
    'city' => '',
    'cityid' => '',
    'date' => '',
    'movieid' => '',
);
// body参数(POST方法下)
$bodyParams = array (
);
// url参数拼接
$url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater';
if (count($queryParams) > 0) {
    $url .= '?' . http_build_query($queryParams);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
    return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($bodyParams));
}

$data = curl_exec($ch);
if (curl_errno($ch)) {
    echo "Error: " . curl_error($ch);
} else {
    print_r($data);
}
curl_close($ch);
/**
 * npm install crypto-js request
 */
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');

// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";

// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';

// 请求方法
var method = 'GET';
// 请求头
var headers = {
    "X-Source": source,
    "X-Date": datetime,
    "Authorization": auth,
}
// 查询参数
var queryParams = {
    'city': '',
    'cityid': '',
    'date': '',
    'movieid': ''}
// body参数(POST方法下)
var bodyParams = {
}
// url参数拼接
var url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater';
if (Object.keys(queryParams).length > 0) {
    url += '?' + querystring.stringify(queryParams);
}

var options = {
    url: url,
    timeout: 5000,
    method: method,
    headers: headers
}
if (['POST', 'PUT', 'PATCH'].indexOf(method) != -1) {
    options['body'] = querystring.stringify(bodyParams);
    options['headers']['Content-Type'] = "application/x-www-form-urlencoded";
}

request(options, function (error, response, body) {
    if (error !== null) {
        console.log('error:', error);
        return;
    }
    console.log(body);
});
package main

import (
    "crypto/hmac"
    "crypto/sha1"
    "encoding/base64"
    "fmt"
    "io"
    "io/ioutil"
    "net/http"
    gourl "net/url"
    "strings"
    "time"
)

func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
    timeLocation, _ := time.LoadLocation("Etc/GMT")
    datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
    signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)

    // hmac-sha1
    mac := hmac.New(sha1.New, []byte(secretKey))
    mac.Write([]byte(signStr))
    sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))

    auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
        secretId, sign)

    return auth, datetime, nil
}

func urlencode(params map[string]string) string {
    var p = gourl.Values{}
    for k, v := range params {
        p.Add(k, v)
    }
    return p.Encode()
}

func main() {
    // 云市场分配的密钥Id
    secretId := "xxxx"
    // 云市场分配的密钥Key
    secretKey := "xxxx"
    source := "market"

    // 签名
    auth, datetime, _ := calcAuthorization(source, secretId, secretKey)

    // 请求方法
    method := "GET"
    // 请求头
    headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}

    // 查询参数
    queryParams := make(map[string]string)
    queryParams["city"] = ""
    queryParams["cityid"] = ""
    queryParams["date"] = ""
    queryParams["movieid"] = ""
    // body参数
    bodyParams := make(map[string]string)

    // url参数拼接
    url := "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater"
    if len(queryParams) > 0 {
        url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
    }

    bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
    var body io.Reader = nil
    if bodyMethods[method] {
        body = strings.NewReader(urlencode(bodyParams))
        headers["Content-Type"] = "application/x-www-form-urlencoded"
    }

    client := &http.Client{
        Timeout: 5 * time.Second,
    }
    request, err := http.NewRequest(method, url, body)
    if err != nil {
        panic(err)
    }
    for k, v := range headers {
        request.Header.Set(k, v)
    }
    response, err := client.Do(request)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()

    bodyBytes, err := ioutil.ReadAll(response.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(bodyBytes))
}
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;


public class CsharpTest
{
    public static String HMACSHA1Text(String EncryptText, String EncryptKey)
    {
            HMACSHA1 hmacsha1 = new HMACSHA1();
            hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);

            byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
            byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
            return Convert.ToBase64String(hashBytes);
    }

    public static void Main(String[] args)
    {
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater";
        String method = "GET";
        String querys = "city=&cityid=&date=&movieid=";
        String source = "market";

        //云市场分配的密钥Id
        String  secretId = "xxx";
        //云市场分配的密钥Key
        String  secretKey = "xxx";

        String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
        url = url + "?" + querys;

        String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
        String sign = HMACSHA1Text(signStr, secretKey);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
        auth = auth + sign + "\"";
        Console.WriteLine(auth + "\n");

        HttpWebRequest httpRequest = null;
        HttpWebResponse httpResponse = null;

        if (url.Contains("https://"))
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
        }
        else
        {
            httpRequest = (HttpWebRequest)WebRequest.Create(url);
        }

        httpRequest.Method = method;
        httpRequest.Headers.Add("Authorization", auth);
        httpRequest.Headers.Add("X-Source", source);
        httpRequest.Headers.Add("X-Date", dt);

        try
        {
            httpResponse = (HttpWebResponse)httpRequest.GetResponse();
        }
        catch (WebException ex)
        {
            httpResponse = (HttpWebResponse)ex.Response;
        }

        Console.WriteLine(httpResponse.StatusCode);
        Console.WriteLine(httpResponse.Headers);
        Stream st = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
        Console.WriteLine(reader.ReadToEnd());
        Console.WriteLine("\n");

    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Encoder;


class Demo {
    public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
            throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
        Mac mac = Mac.getInstance("HmacSHA1");
        Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
        mac.init(sKey);
        byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
        String sig = new BASE64Encoder().encode(hash);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
        return auth;
    }

    public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (sb.length() > 0) {
                sb.append("&");
            }
            sb.append(String.format("%s=%s",
                    URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
                    URLEncoder.encode(entry.getValue().toString(), "UTF-8")
            ));
        }
        return sb.toString();
    }

    public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        //云市场分配的密钥Id
        String secretId = "xxxx";
        //云市场分配的密钥Key
        String secretKey = "xxxx";
        String source = "market";

        Calendar cd = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        String datetime = sdf.format(cd.getTime());
        // 签名
        String auth = calcAuthorization(source, secretId, secretKey, datetime);
        // 请求方法
        String method = "GET";
        // 请求头
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("X-Source", source);
        headers.put("X-Date", datetime);
        headers.put("Authorization", auth);

        // 查询参数
        Map<String, String> queryParams = new HashMap<String, String>();
        queryParams.put("city", "");
        queryParams.put("cityid", "");
        queryParams.put("date", "");
        queryParams.put("movieid", "");
        // body参数
        Map<String, String> bodyParams = new HashMap<String, String>();

        // url参数拼接
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/movietheater";
        if (!queryParams.isEmpty()) {
            url += "?" + urlencode(queryParams);
        }

        BufferedReader in = null;
        try {
            URL realUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
            conn.setConnectTimeout(5000);
            conn.setReadTimeout(5000);
            conn.setRequestMethod(method);

            // request headers
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                conn.setRequestProperty(entry.getKey(), entry.getValue());
            }

            // request body
            Map<String, Boolean> methods = new HashMap<>();
            methods.put("POST", true);
            methods.put("PUT", true);
            methods.put("PATCH", true);
            Boolean hasBody = methods.get(method);
            if (hasBody != null) {
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

                conn.setDoOutput(true);
                DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                out.writeBytes(urlencode(bodyParams));
                out.flush();
                out.close();
            }

            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String result = "";
            while ((line = in.readLine()) != null) {
                result += line;
            }

            System.out.println(result);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}

正常返回示例

                                                                    {
    "status": 0,
    "msg": "ok",
    "result": {
        "movieid": "137363",
        "moviename": "我不是药神",
        "city": "杭州",
        "cityid": "382",
        "date": "2018-07-08",
        "list": [
            {
                "theatername": "海上明珠国际影城西湖店",
                "address": "浙江省杭州市上城区延安南路98号西湖银泰城5楼",
                "issale": "1",
                "minprice": "38",
                "theaterid": "2059",
                "lat": "30.24329",
                "lng": "120.16620",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2059.jpg"
            },
            {
                "theatername": "浙江奥斯卡电影大世界",
                "address": "杭州市下城区龙游路38号",
                "issale": "1",
                "minprice": "38",
                "theaterid": "2070",
                "lat": "30.26205",
                "lng": "120.16010",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2070.jpg"
            },
            {
                "theatername": "杭州海上明珠国际影城",
                "address": "浙江省杭州市下城区东新路822号中大银泰城7楼",
                "issale": "1",
                "minprice": "36",
                "theaterid": "2075",
                "lat": "30.32679",
                "lng": "120.17310",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2075.jpg"
            },
            {
                "theatername": "杭州拱墅万达广场店",
                "address": "杭州市拱墅区杭行路666号万达广场4楼",
                "issale": "1",
                "minprice": "35",
                "theaterid": "2009",
                "lat": "30.32928",
                "lng": "120.11830",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2009.jpg"
            },
            {
                "theatername": "杭州万达影城水晶城店",
                "address": "杭州市拱墅区上塘路458号水晶城购物中心7楼",
                "issale": "1",
                "minprice": "35",
                "theaterid": "2010",
                "lat": "30.30381",
                "lng": "120.15180",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2010.jpg"
            },
            {
                "theatername": "杭州万达影城上亿奥特莱斯店",
                "address": "杭州市余杭区逸盛路190号上亿广场5楼",
                "issale": "1",
                "minprice": "37",
                "theaterid": "2104",
                "lat": "30.37765",
                "lng": "120.11760",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2104.jpg"
            },
            {
                "theatername": "杭州UME国际影城",
                "address": "杭州市文二西路551号西城广场4楼",
                "issale": "1",
                "minprice": "38",
                "theaterid": "2094",
                "lat": "30.28088",
                "lng": "120.09400",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2094.jpg"
            },
            {
                "theatername": "新远国际影城",
                "address": "西湖文化广场8号(C区)",
                "issale": "1",
                "minprice": "58",
                "theaterid": "2073",
                "lat": "30.27686",
                "lng": "120.16330",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2073.jpg"
            },
            {
                "theatername": "中影国际影城杭州永旺店",
                "address": "浙江省杭州市余杭区良渚街道古墩路1888号T301",
                "issale": "1",
                "minprice": "38",
                "theaterid": "2103",
                "lat": "30.36653",
                "lng": "120.03990",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2103.jpg"
            },
            {
                "theatername": "SFC上影影城(杭州龙湖IMAX店)",
                "address": "杭州经济技术开发区金沙大道560号金沙天街商业中心5楼",
                "issale": "1",
                "minprice": "43",
                "theaterid": "2038",
                "lat": "30.34034",
                "lng": "120.24270",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2038.jpg"
            },
            {
                "theatername": "SFC上影影城(杭州临平店)",
                "address": "杭州市余杭区临平藕花洲大街303号沃尔玛4楼",
                "issale": "1",
                "minprice": "35",
                "theaterid": "2107",
                "lat": "30.41564",
                "lng": "120.29820",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2107.jpg"
            },
            {
                "theatername": "萧山德纳IMAX影城",
                "address": "萧山市心中路123号顺发旺角新天地8号楼4楼/市心中路268号银隆百货B座5楼",
                "issale": "1",
                "minprice": "46",
                "theaterid": "2077",
                "lat": "30.16928",
                "lng": "120.26540",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2077.jpg"
            },
            {
                "theatername": "翠苑电影大世界",
                "address": "杭州市文一路298号",
                "issale": "1",
                "minprice": "36",
                "theaterid": "2093",
                "lat": "30.28822",
                "lng": "120.12260",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2093.jpg"
            },
            {
                "theatername": "杭州传奇奢华影城",
                "address": "杭州市拱墅区丰潭路380号银泰城4楼",
                "issale": "1",
                "minprice": "40",
                "theaterid": "2012",
                "lat": "30.29923",
                "lng": "120.10860",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2012.jpg"
            },
            {
                "theatername": "中影国际影城杭州星光大道店",
                "address": "杭州市滨江区星光国际广场2栋4层",
                "issale": "1",
                "minprice": "37",
                "theaterid": "2021",
                "lat": "30.20792",
                "lng": "120.20930",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2021.jpg"
            },
            {
                "theatername": "中影国际影城杭州西溪印象城店",
                "address": "浙江省杭州市余杭区五常大道1号西溪印象城3楼",
                "issale": "1",
                "minprice": "45",
                "theaterid": "2110",
                "lat": "30.24499",
                "lng": "120.03610",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2110.jpg"
            },
            {
                "theatername": "恒隆电影大世界",
                "address": "杭州市萧山区山阴路恒隆广场D座5F",
                "issale": "1",
                "minprice": "33",
                "theaterid": "2084",
                "lat": "30.17881",
                "lng": "120.26100",
                "logo": "http://api.jisuapi.com/movie/upload/theater/1/2084.jpg"
            }
        ]
    }
}

                                                                

返回码定义

返回码
返回信息
描述
201
城市和城市ID为空
202
城市不存在
203
影院ID为空
204
电影ID为空
205
电影ID不存在
206
电影院ID不存在
210
没有信息

当前城市上映电影

调用地址:http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on

请求方式:GET

返回类型:JSON

API调用: API调用说明(secret_id & secret_key)

请求参数(Headers)

名称
类型
是否必须
描述
暂无数据

请求参数(Query)

名称
类型
是否必须
描述
city
string
城市 城市ID和城市任选其一
cityid
string
城市ID
date
string
日期 默认当天

请求参数(Body)

名称
类型
是否必须
描述
暂无数据

请求示例

# -*- coding: utf-8 -*-
from __future__ import print_function

import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime

try:
    from urllib import urlencode
    from urllib2 import Request, urlopen
except ImportError:
    from urllib.parse import urlencode
    from urllib.request import Request, urlopen

# 云市场分配的密钥Id
secretId = "xxxx"
# 云市场分配的密钥Key
secretKey = "xxxx"
source = "market"

# 签名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (secretId, sign.decode('utf-8'))

# 请求方法
method = 'GET'
# 请求头
headers = {
    'X-Source': source,
    'X-Date': datetime,
    'Authorization': auth,
}
# 查询参数
queryParams = {
    'city': '',
    'cityid': '',
    'date': ''}
# body参数(POST方法下存在)
bodyParams = {
}
# url参数拼接
url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on'
if len(queryParams.keys()) > 0:
    url = url + '?' + urlencode(queryParams)

request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
    request.data = urlencode(bodyParams).encode('utf-8')
    request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
    print(content.decode('utf-8'))
curl -v -X GET http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on ?city=&cityid=&date=-H 'Host:service-2n6vk134-1257101137.gz.apigw.tencentcs.com' -H 'Source:source' -H 'Date:Mon, 19 Mar 2018 12:08:40 GMT' -H 'Authorization:hmac id = "AKIDi6qE41WgJ9w8h4h9zq68Vq24d1beIuN0qIwU", algorithm = "hmac-sha1", headers = "date source", signature = yMCxXNytW5nvVGNZ8aBtRxmiLJ4=' -H 'X-Requested-With:XMLHttpRequest' 
//请用云市场分配给您的密钥计算签名并放入请求头,Date为当前的GMT时间
<?php
// 云市场分配的密钥Id
$secretId = 'xxxx';
// 云市场分配的密钥Key
$secretKey = 'xxxx';
$source = 'market';

// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s\nx-source: %s", $datetime, $source);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"', $secretId, $sign);

// 请求方法
$method = 'GET';
// 请求头
$headers = array(
    'X-Source' => $source,
    'X-Date' => $datetime,
    'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
    'city' => '',
    'cityid' => '',
    'date' => '',
);
// body参数(POST方法下)
$bodyParams = array (
);
// url参数拼接
$url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on';
if (count($queryParams) > 0) {
    $url .= '?' . http_build_query($queryParams);
}

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
    return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($bodyParams));
}

$data = curl_exec($ch);
if (curl_errno($ch)) {
    echo "Error: " . curl_error($ch);
} else {
    print_r($data);
}
curl_close($ch);
/**
 * npm install crypto-js request
 */
var CryptoJS = require("crypto-js");
var request = require('request');
var querystring = require('querystring');

// 云市场分配的密钥Id
var secretId = "xxx";
// 云市场分配的密钥Key
var secretKey = "xxx";
var source = "market";

// 签名
var datetime = (new Date()).toGMTString();
var signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
var sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(signStr, secretKey))
var auth = 'hmac id="' + secretId + '", algorithm="hmac-sha1", headers="x-date x-source", signature="' + sign + '"';

// 请求方法
var method = 'GET';
// 请求头
var headers = {
    "X-Source": source,
    "X-Date": datetime,
    "Authorization": auth,
}
// 查询参数
var queryParams = {
    'city': '',
    'cityid': '',
    'date': ''}
// body参数(POST方法下)
var bodyParams = {
}
// url参数拼接
var url = 'http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on';
if (Object.keys(queryParams).length > 0) {
    url += '?' + querystring.stringify(queryParams);
}

var options = {
    url: url,
    timeout: 5000,
    method: method,
    headers: headers
}
if (['POST', 'PUT', 'PATCH'].indexOf(method) != -1) {
    options['body'] = querystring.stringify(bodyParams);
    options['headers']['Content-Type'] = "application/x-www-form-urlencoded";
}

request(options, function (error, response, body) {
    if (error !== null) {
        console.log('error:', error);
        return;
    }
    console.log(body);
});
package main

import (
    "crypto/hmac"
    "crypto/sha1"
    "encoding/base64"
    "fmt"
    "io"
    "io/ioutil"
    "net/http"
    gourl "net/url"
    "strings"
    "time"
)

func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
    timeLocation, _ := time.LoadLocation("Etc/GMT")
    datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
    signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)

    // hmac-sha1
    mac := hmac.New(sha1.New, []byte(secretKey))
    mac.Write([]byte(signStr))
    sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))

    auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
        secretId, sign)

    return auth, datetime, nil
}

func urlencode(params map[string]string) string {
    var p = gourl.Values{}
    for k, v := range params {
        p.Add(k, v)
    }
    return p.Encode()
}

func main() {
    // 云市场分配的密钥Id
    secretId := "xxxx"
    // 云市场分配的密钥Key
    secretKey := "xxxx"
    source := "market"

    // 签名
    auth, datetime, _ := calcAuthorization(source, secretId, secretKey)

    // 请求方法
    method := "GET"
    // 请求头
    headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}

    // 查询参数
    queryParams := make(map[string]string)
    queryParams["city"] = ""
    queryParams["cityid"] = ""
    queryParams["date"] = ""
    // body参数
    bodyParams := make(map[string]string)

    // url参数拼接
    url := "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on"
    if len(queryParams) > 0 {
        url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
    }

    bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
    var body io.Reader = nil
    if bodyMethods[method] {
        body = strings.NewReader(urlencode(bodyParams))
        headers["Content-Type"] = "application/x-www-form-urlencoded"
    }

    client := &http.Client{
        Timeout: 5 * time.Second,
    }
    request, err := http.NewRequest(method, url, body)
    if err != nil {
        panic(err)
    }
    for k, v := range headers {
        request.Header.Set(k, v)
    }
    response, err := client.Do(request)
    if err != nil {
        panic(err)
    }
    defer response.Body.Close()

    bodyBytes, err := ioutil.ReadAll(response.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(bodyBytes))
}
using System.IO;
using System.Text;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System;


public class CsharpTest
{
    public static String HMACSHA1Text(String EncryptText, String EncryptKey)
    {
            HMACSHA1 hmacsha1 = new HMACSHA1();
            hmacsha1.Key = System.Text.Encoding.UTF8.GetBytes(EncryptKey);

            byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes(EncryptText);
            byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
            return Convert.ToBase64String(hashBytes);
    }

    public static void Main(String[] args)
    {
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on";
        String method = "GET";
        String querys = "city=&cityid=&date=";
        String source = "market";

        //云市场分配的密钥Id
        String  secretId = "xxx";
        //云市场分配的密钥Key
        String  secretKey = "xxx";

        String dt = DateTime.UtcNow.GetDateTimeFormats('r')[0];
        url = url + "?" + querys;

        String signStr = "x-date: " + dt + "\n" + "x-source: " + source;
        String sign = HMACSHA1Text(signStr, secretKey);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"";
        auth = auth + sign + "\"";
        Console.WriteLine(auth + "\n");

        HttpWebRequest httpRequest = null;
        HttpWebResponse httpResponse = null;

        if (url.Contains("https://"))
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
            httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url));
        }
        else
        {
            httpRequest = (HttpWebRequest)WebRequest.Create(url);
        }

        httpRequest.Method = method;
        httpRequest.Headers.Add("Authorization", auth);
        httpRequest.Headers.Add("X-Source", source);
        httpRequest.Headers.Add("X-Date", dt);

        try
        {
            httpResponse = (HttpWebResponse)httpRequest.GetResponse();
        }
        catch (WebException ex)
        {
            httpResponse = (HttpWebResponse)ex.Response;
        }

        Console.WriteLine(httpResponse.StatusCode);
        Console.WriteLine(httpResponse.Headers);
        Stream st = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8"));
        Console.WriteLine(reader.ReadToEnd());
        Console.WriteLine("\n");

    }

    public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
    {
        return true;
    }
}
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

import sun.misc.BASE64Encoder;


class Demo {
    public static String calcAuthorization(String source, String secretId, String secretKey, String datetime)
            throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        String signStr = "x-date: " + datetime + "\n" + "x-source: " + source;
        Mac mac = Mac.getInstance("HmacSHA1");
        Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm());
        mac.init(sKey);
        byte[] hash = mac.doFinal(signStr.getBytes("UTF-8"));
        String sig = new BASE64Encoder().encode(hash);

        String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\"";
        return auth;
    }

    public static String urlencode(Map<?, ?> map) throws UnsupportedEncodingException {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            if (sb.length() > 0) {
                sb.append("&");
            }
            sb.append(String.format("%s=%s",
                    URLEncoder.encode(entry.getKey().toString(), "UTF-8"),
                    URLEncoder.encode(entry.getValue().toString(), "UTF-8")
            ));
        }
        return sb.toString();
    }

    public static void main(String[] args) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
        //云市场分配的密钥Id
        String secretId = "xxxx";
        //云市场分配的密钥Key
        String secretKey = "xxxx";
        String source = "market";

        Calendar cd = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        String datetime = sdf.format(cd.getTime());
        // 签名
        String auth = calcAuthorization(source, secretId, secretKey, datetime);
        // 请求方法
        String method = "GET";
        // 请求头
        Map<String, String> headers = new HashMap<String, String>();
        headers.put("X-Source", source);
        headers.put("X-Date", datetime);
        headers.put("Authorization", auth);

        // 查询参数
        Map<String, String> queryParams = new HashMap<String, String>();
        queryParams.put("city", "");
        queryParams.put("cityid", "");
        queryParams.put("date", "");
        // body参数
        Map<String, String> bodyParams = new HashMap<String, String>();

        // url参数拼接
        String url = "http://service-2n6vk134-1257101137.gz.apigw.tencentcs.com/release/movie/on";
        if (!queryParams.isEmpty()) {
            url += "?" + urlencode(queryParams);
        }

        BufferedReader in = null;
        try {
            URL realUrl = new URL(url);
            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
            conn.setConnectTimeout(5000);
            conn.setReadTimeout(5000);
            conn.setRequestMethod(method);

            // request headers
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                conn.setRequestProperty(entry.getKey(), entry.getValue());
            }

            // request body
            Map<String, Boolean> methods = new HashMap<>();
            methods.put("POST", true);
            methods.put("PUT", true);
            methods.put("PATCH", true);
            Boolean hasBody = methods.get(method);
            if (hasBody != null) {
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

                conn.setDoOutput(true);
                DataOutputStream out = new DataOutputStream(conn.getOutputStream());
                out.writeBytes(urlencode(bodyParams));
                out.flush();
                out.close();
            }

            // 定义 BufferedReader输入流来读取URL的响应
            in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String result = "";
            while ((line = in.readLine()) != null) {
                result += line;
            }

            System.out.println(result);
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }
}

正常返回示例

                                                                    {
    "status": 0,
    "msg": "ok",
    "result": {
        "city": "杭州",
        "cityid": "382",
        "date": "2018-07-08",
        "list": [
            {
                "movieid": "137363",
                "moviename": "我不是药神",
                "pic": "http://api.jisuapi.com/movie/upload/movie/14/137363.jpg"
            },
            {
                "movieid": "137197",
                "moviename": "动物世界",
                "pic": "http://api.jisuapi.com/movie/upload/movie/14/137197.jpg"
            },
            {
                "movieid": "140409",
                "moviename": "新大头儿子和小头爸爸3:俄罗斯奇遇记",
                "pic": "http://api.jisuapi.com/movie/upload/movie/15/140409.jpg"
            },
            {
                "movieid": "17594",
                "moviename": "侏罗纪世界2",
                "pic": "http://api.jisuapi.com/movie/upload/movie/2/17594.jpg"
            },
            {
                "movieid": "8702",
                "moviename": "超人总动员2",
                "pic": "http://api.jisuapi.com/movie/upload/movie/1/8702.jpg"
            },
            {
                "movieid": "136269",
                "moviename": "金蝉脱壳2",
                "pic": "http://api.jisuapi.com/movie/upload/movie/14/136269.jpg"
            },
            {
                "movieid": "350",
                "moviename": "阿飞正传",
                "pic": "http://api.jisuapi.com/movie/upload/movie/1/350.jpg"
            },
            {
                "movieid": "140586",
                "moviename": "细思极恐",
                "pic": "http://api.jisuapi.com/movie/upload/movie/15/140586.jpg"
            },
            {
                "movieid": "140753",
                "moviename": "您一定不要错过",
                "pic": ""
            },
            {
                "movieid": "137628",
                "moviename": "龙虾刑警",
                "pic": "http://api.jisuapi.com/movie/upload/movie/14/137628.jpg"
            },
            {
                "movieid": "8001",
                "moviename": "猛虫过江",
                "pic": "http://api.jisuapi.com/movie/upload/movie/1/8001.jpg"
            },
            {
                "movieid": "140750",
                "moviename": "姽婳",
                "pic": "http://api.jisuapi.com/movie/upload/movie/15/140750.jpg"
            },
            {
                "movieid": "11112",
                "moviename": "暹罗决:九神战甲",
                "pic": "http://api.jisuapi.com/movie/upload/movie/2/11112.jpg"
            },
            {
                "movieid": "140754",
                "moviename": "生存家族",
                "pic": ""
            },
            {
                "movieid": "140041",
                "moviename": "潜艇总动员:海底两万里",
                "pic": "http://api.jisuapi.com/movie/upload/movie/15/140041.jpg"
            },
            {
                "movieid": "140751",
                "moviename": "我的诗篇",
                "pic": "http://api.jisuapi.com/movie/upload/movie/15/140751.jpg"
            },
            {
                "movieid": "138863",
                "moviename": "泄密者",
                "pic": "http://api.jisuapi.com/movie/upload/movie/14/138863.jpg"
            },
            {
                "movieid": "140752",
                "moviename": "最后一球",
                "pic": "http://api.jisuapi.com/movie/upload/movie/15/140752.jpg"
            },
            {
                "movieid": "310",
                "moviename": "复仇者联盟3:无限战争",
                "pic": "http://api.jisuapi.com/movie/upload/movie/1/310.jpg"
            },
            {
                "movieid": "1730",
                "moviename": "寂静之地",
                "pic": "http://api.jisuapi.com/movie/upload/movie/1/1730.jpg"
            },
            {
                "movieid": "127361",
                "moviename": "第七个小矮人",
                "pic": "http://api.jisuapi.com/movie/upload/movie/13/127361.jpg"
            },
            {
                "movieid": "140584",
                "moviename": "小悟空",
                "pic": "http://api.jisuapi.com/movie/upload/movie/15/140584.jpg"
            },
            {
                "movieid": "133229",
                "moviename": "阿修罗",
                "pic": "http://api.jisuapi.com/movie/upload/movie/14/133229.jpg"
            },
            {
                "movieid": "128837",
                "moviename": "邪不压正",
                "pic": "http://api.jisuapi.com/movie/upload/movie/13/128837.jpg"
            },
            {
                "movieid": "140755",
                "moviename": "摩天营救",
                "pic": ""
            },
            {
                "movieid": "140756",
                "moviename": "汪星卧底",
                "pic": ""
            }
        ]
    }
}
                                                                

返回码定义

返回码
返回信息
描述
201
城市和城市ID为空
202
城市不存在
203
影院ID为空
204
电影ID为空
205
电影ID不存在
206
电影院ID不存在
210
没有信息

商品介绍

查询今日上映电影,电影信息,电影院及上映信息。

使用指南

1购买完成后,点击进入控制台

2在控制台点击”管理“查看详情”

3获得API的SecretID和SecretKey后,即可按照商品介绍里的方式调用API

累计评价(0)

为保障您的权益,请勿线下交易!90%的欺诈、纠纷、资金盗窃均由线下交易导致。腾讯云市场为您提供以下服务保障:

优质服务商家

严格准入 提供海量上云服务

7*8小时在线客服

全程在线咨询 助您安心购物

专业测试保证品质

安全监测 保障商品质量

退款售后无忧

不满意可退款 保障售后无忧

卖家服务时间

为保障您的权益,请勿线下交易!90%的欺诈、纠纷、资金盗窃均由线下交易导致。