您是否知道API可以让您与现实生活中的股票或货币进行交易?
如果是,请描述您的体验:
我正在设计一个Web应用程序,然后停下来考虑如何将我的api设计为RESTful Web服务.目前,我的大部分URI都是通用的,可能适用于各种网络应用:
GET /logout // destroys session and redirects to /
GET /login // gets the webpage that has the login form
POST /login // authenticates credentials against database and either redirects home with a new session or redirects back to /login
GET /register // gets the webpage that has the registration form
POST /register // records the entered information into database as a new /user/xxx
GET /user/xxx // gets and renders current user data in a profile view
POST …Run Code Online (Sandbox Code Playgroud) 例如,这句话是什么意思?
在任何现代Web应用程序中,与外部API集成几乎是一种保证.要有效地测试此类集成,您需要将其存根.一个好的存根应该易于创建,并且始终与实际的当前API响应保持同步.在这篇文章中,我们将概述使用存根的外部API 的测试策略.
我试图跟随Twitter的API来获取用户的关注者列表.
http://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=username
我收到此错误消息作为回应.
{
code = 215;
message = "Bad Authentication data";
}
Run Code Online (Sandbox Code Playgroud)
我似乎无法找到与此错误代码相关的文档.有人对这个错误有任何想法吗?
我按照这里的说明操作:
这个应用程序的开发人员没有为Facebook登录正确设置此应用程序?
公开我的应用程序,圈子是绿色的,所以应用程序是公开的.
但是当我尝试登录时,我转到Facebook应用程序,它要求我登录我做的,然后我收到此消息:
应用程序未设置:此应用程序仍处于开发模式,您无权访问它.切换到已注册的测试用户或向应用管理员询问权限.
顺便说一句:我是管理员
任何帮助深表感谢.我使用的是SeattleClouds,这种情况发生在iOS和Android上.
据我所知,Windows没有提供API函数来告诉应用程序注册了一个全局热键(通过RegisterHotkey).我只能发现如果RegisterHotkey返回false,则注册了热键,但不是"拥有"热键的人.
在没有直接API的情况下,是否会有迂回的方式?Windows维护与每个注册热键相关联的句柄 - 这有点令人抓狂,因此无法获取此信息.
可能不起作用的示例:发送(模拟)已注册的热键,然后拦截Windows将发送给注册它的进程的热键消息.首先,我不认为拦截消息会显示目标窗口句柄.其次,即使有可能,这也是一件坏事,因为发送热键会触发各种程序中各种可能不需要的活动.
这并不重要,但我已经看到了对这种功能的频繁请求,并且我自己也是注册热键的应用程序的受害者,甚至没有在UI或文档中的任何地方公开它.
(在Delphi工作,只不过是WinAPI的学徒,请善待.)
我们正在考虑将我们的Rest API服务器(它在Web服务中,在Symfony PHP上)移动到Scala有以下几个原因:速度,无开销,更少的CPU,更少的代码,可扩展性等.我不知道Scala直到几个几天前,但我一直很享受这些天我用Scala书和所有博客文章和问题学习的东西(它不是那么难看!)
我有以下选择:
我将不得不使用的一些东西:HTTP请求,JSON输出,MySQL(数据),OAuth,Memcache(缓存),日志,文件上传,统计(可能是Redis).
你会推荐什么?
我希望我的ruby on rails应用程序中的用户能够向我的外部票务管理系统squishlist.com提交票证.他们有api和说明如下.您需要进行身份验证并获取令牌,然后使用令牌提交票证.来自squishlist.
# get the token
https://api.squishlist.com/auth/?cfg=testcorp&user_key=privatekey&api_key=TEST-KEY-12345
=> {"token": "authtoken",
"expires": "2010-06-16 13:31:56"}
# and then the ticket with the token
https://api.squishlist.com/rest/?cfg=testcorp&token=authtoken&method=squish.issue.submit&prj=demo
POST data: {'issue_type': 1, 'subject': 'Hello, world.', 4: 'Open', 5: 10}
Run Code Online (Sandbox Code Playgroud)
出于测试目的,我创建了一个控制器,路由和视图(页面)进行测试.在我的控制器上,我有以下内容
require 'httparty'
require 'json'
class SubmitticketController < ApplicationController
def submit_a_ticket
@cfg = 'xxxsupport'
@user_key = '4787fsdbbfbfsdbhbfad5aba91129a3f1ed1b743321f7b'
@api_key = 'MrUser411'
@project = 'excelm-manoke'
@url_new_string = 'https://api.squishlist.com/auth/?cfg='+@cfg+'&user_key='+@user_key+'&api_key='+@api_key
# https://api.squishlist.com/auth/?cfg=xxxsupport&user_key=4787fsdbbfbfsdbhbfad5aba91129a3f1ed1b743321f7b&api_key=MrUser411 - this is what is created by @url_new_string
response = HTTParty.get(@url_new_string.to_str) #submit the string to get the token …Run Code Online (Sandbox Code Playgroud) 简单的问题,从可读性的角度来看,您更喜欢哪种方法名称作为布尔方法:
public boolean isUserExist(...)
Run Code Online (Sandbox Code Playgroud)
要么:
public boolean doesUserExist(...)
Run Code Online (Sandbox Code Playgroud)
要么:
public boolean userExists(...)
Run Code Online (Sandbox Code Playgroud)