Reputation:
I am new to the area of Rest API. And I am working on a third party web application, that provides an API to execute some of its actions. And one of these actions is adding a new Server. So I specified the following:-
http://win-spdev:8400/servlets/AssetServlet?Operation='AddAsset'&assetName='serverfromapi'&assetType='server'&model='Unkown Server'&Product Name='Unknown%20Server'&siteName='s1'&accountName='customer3'&username='admin'&password='admin'&DOMAIN_NAME='win-spdev:8400'&logonDomainName=
But I will get “#”, when I wrote the above insdie my browser. So basically is my API call format a valid one ?
Upvotes: 0
Views: 109
Reputation:
An URL like
http://win-spdev:8400/servlets/AssetServlet?Operation='AddAsset'&assetName='serverfromapi'&assetType='assetType'&model='Unkown Server'&Product Name='Unknown%20Server'&siteName='s1'&accountName='customer3'&username='admin'&password='admin'&DOMAIN_NAME='win-spdev:8400'&logonDomainName=
is not RESTful. This is RPC over HTTP.
If you want to add a Server
resource in a RESTful way, an API like this would be possible:
The URL
POST /path/to/servers
The body
{
'assetName':'serverfromapi',
'assetType':'assetType',
'model':'Unkown Server',
'Product Name':'Unknown Server',
'siteName':'s1',
'accountName':'customer3',
'username':'admin',
'password':'admin',
'DOMAIN_NAME':'win-spdev:8400',
'logonDomainName':''
}
Upvotes: 1