Methods of Calling for REST
Last Update: 2017/03/22
The following is an example of hicloud CaaS / CVPC API calling (take runInstances for example):
https://hws.hicloud.hinet.net/cloud_hws/api/hws/?action=runInstances&version=2013-03-29 &chtAuthType=hwspass&imageId=hi-olajtpss&instanceType=HC1.S.LINUX&monitoringEnabled=false &instanceName=myInstance&count=1&accessKey=U0U0MU5UQXhNREF3TVRFek5qSTVPRFkxTURneU1UWT0 &expires=2013-03-13T17%3A50%3A04%Z&signature=VGMS-tWF3Xa2ixBhwvzgi7Aplhc
- Related information on hicloud CaaS / CVPC API
- Server: hws.hicloud.hinet.net
- Port: 443
- HTTP protocol: HTTPS
- Action: /cboss-hws-web/api/hws/
- Go to hicloud user platform to acquire Access Key and Secret KeyFor example:
- Access Key: U0U0MU5UQXhNREF3TVRFek5qSTVPRFkxTURneU1UWT0
- Secret key: WWpJNU16a3pOV1JsWWpNeU5HVXdOMkkxTURNd1lUbG1OMlEwTXpSaFptST0
- Go to the Common Parameterpage at right side of Developer Center > hicloud CaaS >VM > Welcome, To prepare for the following parameters :
- chtAuthType=hwspass
- version=2013-03-29 (Varies in different versions.)
expires=2013-03-17T17%3A50%3A04Z (It is suggested to add 15 minutes to the current system time in ISO 8601 format. During URL transmission, some special characters would be replaced, such as “:”, “+” …Therefore, the original 2013-03-17T17:50:04Z would be replaced with 2013-03-17T17%3A50%3A04Z)
- accessKey=U0U0MU5UQXhNREF3TVRFek5qSTVPRFkxTURneU1UWT0
- action=runInstances
- See description of Request Parameter at Developer Center > hicloud CaaS > VM > Actions > runInstances,To prepare for the following parameters :
- imageId=hi-olajtpss
- instanceType=HC1.S.LINUX
- monitoringEnabled=false
- instanceName=myInstance
- count=1
- The transmitted Request Parameter value should undergo URL encoding
- Example
Original ValueURL EncodeDescriptionnoun phrase noun%20phrase Empty Space vm!@#$%^&*()-=_+[]{};':",./<>?999 vm!%40%23%24%25%5E%26*()-%
3D_%2B%5B%5D%7B%7D%3B%27
%3A%22%2C.%2F%3C%3E%3F999 - References
- Wikipedia-Encoding of Percent-encoding
(http://en.wikipedia.org/wiki/Percent-encoding) - URL Encode and Decode Tool (http://www.url-encode-decode.com/)
- Wikipedia - UTF-8 (http://en.wikipedia.org/wiki/UTF-8)
- Wikipedia-Encoding of Percent-encoding
- Example
- 3. With the abovementioned information, the following url can be produced.
- According to Signature code example, along with Secret Key and url at the last step, a website with signature can be produced.
https://hws.hicloud.hinet.net/cloud_hws/api/hws/?action=runInstances&version=2013-03-29&chtAuthType=hwspass& imageId=hi-olajtpss&instanceType=HC1.S.LINUX&monitoringEnabled=false&instanceName=myInstance&count=1& accessKey=U0U0MU5UQXhNREF3TVRFek5qSTVPRFkxTURneU1UWT0&expires=2013-03-13T17%3A50%3A04%Z& signature=VGMS-tWF3Xa2ixBhwvzgi7Aplhc
- Execute the action through REST. Take Firefox + RESTClient for example.
- Fill in GET in Method.
- Fill in a website with Signature in URL.
- Press “SEND”
- The result of the execution can be found in Response section.



https://hws.hicloud.hinet.net/cloud_hws/api/hws/?action=runInstances&version=2013-03-29& chtAuthType=hwspass&imageId=hi-olajtpss&instanceType=HC1.S.LINUX&monitoringEnabled=false& instanceName=myInstance&count=1&accessKey=U0U0MU5UQXhNREF3TVRFek5qSTVPRFkxTURneU1UWT0& expires=2013-03-13T17%3A50%3A04%Z
