Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
317 views
in Technique[技术] by (71.8m points)

javascript - 实际上,API访问控制允许源(Indeed API Access Control Allow Origin)

I want to use the API from indeed.com ( https://ads.indeed.com/ ).

(我想使用来自finally.com( https://ads.indeed.com/ )的API 。)

The problem is, that they set their Response to "Same Origin" -> Meaning I can't use it on my platform.

(问题是,他们将响应设置为“相同来源”->表示我不能在平台上使用它。)

Since there is not much on google to find the question is, if anyone has figured out how to work with this API ?

(由于在Google上找不到太多的问题,是否有人想出如何使用此API ?)

Example request:

(请求示例:)

http://api.indeed.com/ads/apisearch?publisher=xxxxx&q=java&l=austin%2C+tx&sort=&radius=&st=&jt=&start=&limit=&fromage=&filter=&latlong=1&co=us&chnl=&v=2&format=json&callback=results&v=2

(http://api.indeed.com/ads/apisearch?publisher=xxxxx&q=java&l=austin%2C+tx&sort=&radius=&st=&jt=&start=&limit=&fromage=&filter=&latlong=1&co=us&chnl=&v=2&format= json&callback = results&v = 2)

Example response headers:

(响应头示例:)

 HTTP/1.1 200 OK
Date: Thu, 04 Aug 2016 12:59:01 GMT
Server: Apache
Set-Cookie: CTK=1apaq5d2k5mlkchh; Expires=Tue, 09-Aug-2033 07:47:32 GMT; Path=/
Set-Cookie: ctkgen=1; Expires=Thu, 04-Aug-2016 13:02:01 GMT; Path=/
Set-Cookie: JSESSIONID=47FBC363B7DE7AA7FB455319986F2DC3.jasxA_iad-job4; Path=/; HttpOnly
X-Frame-Options: SAMEORIGIN
Pragma: no-cache
Cache-control: no-store, no-cache, must-revalidate, private
Expires: Thu, 04 Aug 2016 12:58:01 GMT
X-Content-Type-Options: nosniff
Vary: User-Agent,Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=30, max=29977
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/javascript;charset=UTF-8
Set-Cookie: BIGipServerjob_iad=!WcxX2VJ58OOojFQRNhs+rOzpOInz86YFI2BZzMsbv9orNwX4rj5v6T936m7gDvyWulSDIiDuepFONA==; path=/
  ask by Fabian Lurz translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I basically fixed it by using a Server Side language (in this case Java) to make a request to the api.

(我基本上通过使用服务器端语言(在本例中为Java)对api进行了修复。)

This solved the problem.

(这样就解决了问题。)

It is probably by design, so that the publisher ID is not visible by the client.

(这可能是设计使然,因此客户端看不到发布者ID。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...