求教啊,公司要我和另一个网站平台实现数据接口对接,谁做过的。进来聊聊。
请问要怎样做个接口供对方调用,是api接口,返回数据格式是json,https请求协议。通过这个接口目的是实现公司网站数据库里的一些数据能够展示在对方平台。我已经和对方平台商量好了,他们把接口开发文档给我了,只要我这边做个数据接口给他们就行了。本人新手一枚,第一次开发接口,文档看的不是很明白,完全没思路啊。求教各位做的的大神指点指点,详细一点。谢谢大家了
回复讨论(解决方案)
既然有 接口开发文档,那么就贴出来看看
既然有 接口开发文档,那么就贴出来看看
恩,好的 三、接口概要
米袋360需要的数据有两种:
?每日成交标的列表。指每日成功交易进入还款阶段的标的集合。
?每日新增标的列表。指每日新发布尚在投标阶段的标的集合。
这两种数据按日期查询,返回数据为数组,包含若干条标的数据。详细含义见本节最后部分的补充说明。
接口请求协议: http或https
接口请求参数: 请求参数
?查询日期:date=20140730 (个位数的月和日需带前导的0,例如:2014年7月3日的参数为20140703)
?列表类型:type=success/new (success为成交标的列表,new为新增标的列表)
?验证字段:token或username+password等。详情参见以下“请求验证方法”部分。
返回数据格式: json
请求验证方法: 有三种可选的验证方法,平台可酌情选择。
?请求参数中带上平台分配给米袋360的验证字段。该字段可设置为一个或多个,字段名与值不限。例如:
username:medai360
password:12345678
?token方式:首先通过平台设置的一个地址取得可用token,再使用token取得标的列表。token获取地址举例:
http(s)://www.platform.com/api/token?date=20140730&username=medai360&password=12345678
参数中的username与password为平台为米袋360准备的用户名和密码。
返回数据(文本格式):
请求正确: token=1wegsdgy3e4u623tf78hvqf32478ya5 (字符串:token=32位的token字符串,总共38位)
请求错误: error
?公开接口,不需要验证。在这种情况下,任何请求都可返还json数据。
平台可根据自己的情况,选择使用的验证方法。并将需要的验证参数通过邮件发送给米袋360。邮箱:medai360@medai360.com
最后,两个完整的接口url示例:
http(s)://www.platform.com/api/loans/success?date=20140730&username=medai360&password=12345678
http(s)://www.platform.com/api/loans/success?date=20140730&token=1wegsdgy3e4u623tf78hvqf32478ya5
四、接口返回数据
两种类型的列表返回格式相同,但对各字段的必填要求情况不同
{
"date":"2014-07-30", //个位数的月和日须带前导的0,例如7月为“07”、5日为“05”
"loans":[{
"id": "1234", //标的ID。唯一标识
"title": "标题", //标的标题
"desc": "描述", //标的描述或详情,文字形式。限1000个字符以内。可选
"borrower": "借款人", //借款人的名字或用户ID。可选
"amount": "500000", //标的金额
"interest": "18.00", //利率
"bidnum": "10", //投标人次
"time_0": "2014-01-18 12:00", //发标时间。可选,但建议填写
"time_1": "2014-07-20 12:00", //满标时间。未满标则可选,或为空
"time_2": "2014-07-15 12:00", //成交时间。未成交则可选,或为空
"url": "http://www.platform.com/loans/id.html", //标的页面地址
标的类型标志和含义对应表(加粗为较重要的类型,希望严格遵照填写)
类型标志 含义
jingzhi 净值标
tian 天标
jiangli 奖励标
diya 抵押标
xinyong 信用标
tuijian 推荐标
danbao 担保标
qiye 企业标
tiyan 体验标/新手标
liuzhuan 流转标
bao 保障标/保本标
licai 理财标
miao 秒标
dingxiang 定向标
dingshi 定时标
yuyue 预约标
文?不是?得?清楚的了 ?手做呀 做到不?解的地方和?方?通或者再上??,你在什?地方有??呢?
文档写得很明白了,你用json格式,按文档来获取和输出就可以了。
文档写清楚了,剩下的就是业务逻辑的处理了。应该问题不大
PHP解析JOSN数据为对象,然后处理,完了
没看到有价值的回复

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.
