请问要怎样做个接口供对方调用,是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数据为对象,然后处理,完了
没看到有价值的回复

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


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

SublimeText3 English version
Recommended: Win version, supports code prompts!

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver CS6
Visual web development tools

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

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