惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 司徒正美
N
News | PayPal Newsroom
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
S
Secure Thoughts
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Security Archives - TechRepublic
Security Archives - TechRepublic
博客园 - 【当耐特】
博客园 - 聂微东
S
Securelist
宝玉的分享
宝玉的分享
爱范儿
爱范儿
IT之家
IT之家
T
The Exploit Database - CXSecurity.com
S
SegmentFault 最新的问题
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
AI
AI
Security Latest
Security Latest
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Last Watchdog
The Last Watchdog
月光博客
月光博客
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Schneier on Security
人人都是产品经理
人人都是产品经理
Webroot Blog
Webroot Blog
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
J
Java Code Geeks
N
News and Events Feed by Topic
Recent Commits to openclaw:main
Recent Commits to openclaw:main
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
S
Security Affairs
美团技术团队
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
罗磊的独立博客
Spread Privacy
Spread Privacy
Help Net Security
Help Net Security
T
Tailwind CSS Blog
C
Cybersecurity and Infrastructure Security Agency CISA
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - 绿叶

Suspicions about the new platform dynamic sorting expression builder 台服信长之野望全后台辅助外挂 SEO Elite ver 4.0 R93 Patcher Remove 5 seconds constraint in Garena(GGC) - 绿叶 Robot development framework in Mush Client (Lua) 巧用Marshal.GetDelegateForFunctionPointer--C#如何调用按键精灵插件dll Using .Net, Flex, and Red5 to create a flash web application 做了个C#的Hotkey简单封装,希望对大家有帮助 功夫世界外挂发布测试 我的第一个全后台CALL外挂-功夫世界外挂 通过修改Mutex来达到大航海OL多开 如何利用WPE对大航海Online进行港内瞬移,瞬时生产和快速进港 MonoRail PetShop Source Code Released MS PetShop3 -> MonoRail PetShop 完成移植 移植MSPetShop3到Castle MonoRail -Model与DAL层的移植(AR) 对 "闭包-closure" 的一些见解 圈内Castle文章索引 利用Castle Framework发email是如此easy
How to create your own api with ACL in Magento
绿叶 · 2010-03-12 · via 博客园 - 绿叶

Finally, I got my customize api works with Magento today. I was confusing by the complex configuration xml files in magento, here I post my example which might be helpful though.

This example passed testing under Magento ver 1.3.2.4 using XML-RPC in .net platform.

Steps:

1. /app/etc/modules/Hanix_All.xml

1 <?xml version="1.0"?>
2 <config>
3   <modules>
4     <Hanix_Customize>
5       <active>true</active>
6       <codePool>local</codePool>
7     </Hanix_Customize>
8   </modules>
9 </config>

2. /app/code/local/Hanix/

3. /app/code/local/Hanix/Customize/etc/config.xml

 1 <?xml version="1.0"?>
 2 <config>
 3 
 4   <modules>
 5     <Hanix_Customize>
 6       <version>0.1.0</version>
 7     </Hanix_Customize>
 8   </modules>
 9 
10   <global>
11 
12     <models>
13       <customize>
14         <class>Hanix_Customize_Model</class>
15       </customize>
16     </models>
17 
18   </global>
19 
20 </config>

4. /app/code/local/Hanix/Customize/etc/api.xml

 1 <?xml version="1.0"?>
 2 <config>
 3   <api>
 4     
 5     <resources>
 6       <customize_api translate="title" module="customize">
 7         
 8         <title>Customize Resource</title>
 9         <model>customize/api</model>
10         <acl>customize</acl>
11 
12         <methods>
13           <test translate="title" module="customize">
14             <title>Test Method</title>
15             <acl>customize/test</acl>
16           </test>
17         </methods>
18         
19       </customize_api>
20     </resources>
21 
22     <acl>
23       <resources>
24         <customize translate="title" module="customize">
25           <title>Customize APIs</title>
26           <sort_order>1</sort_order>
27           <test translate="title" module="customize">
28             <title>Test api</title>
29           </test>
30         </customize>
31       </resources>
32     </acl>
33 
34   </api>
35 </config>

5. /app/code/local/Hanix/Customize/Model/Api.php

1 <?php
2 
3 class Hanix_Customize_Model_Api extends Mage_Api_Model_Resource_Abstract
4 {
5     public function test()
6     {
7         return "hello test...";
8     }
9 }

OK! that are the five steps what you need to be done. And don't forget to refresh the magento cache or just simply disable it. Now go to Magento backend: System/Web Service/Roles. Your api will be there.

Now, you can create an web service account to perform test. I used my own xml-rpc api showed below:

As can be seen, string "hello test..." returns correctly.