<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>API Archives - ServerStadium</title>
	<atom:link href="https://serverstadium.com/knowledge-base/tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>https://serverstadium.com/knowledge-base/tag/api/</link>
	<description>Public Cloud Solution by ServerStadium</description>
	<lastBuildDate>Thu, 04 Jan 2024 23:35:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://serverstadium.com/wp-content/uploads/2023/04/cropped-favicon-1-32x32.png</url>
	<title>API Archives - ServerStadium</title>
	<link>https://serverstadium.com/knowledge-base/tag/api/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Using GraphQL for Efficient Data Retrieval on Web Applications</title>
		<link>https://serverstadium.com/knowledge-base/using-graphql-for-efficient-data-retrieval-on-web-applications/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Thu, 04 Jan 2024 23:35:18 +0000</pubDate>
				<guid isPermaLink="false">https://serverstadium.com/?post_type=epkb_post_type_1&#038;p=11855</guid>

					<description><![CDATA[<p>Introduction GraphQL&#8217;s flexibility and efficiency in data retrieval make it a superior choice for modern web applications. Deploying GraphQL on ServerStadium’s infrastructure (VM Pricing, Dedicated Servers) ensures scalable and optimized data handling capabilities for your web services. Prerequisites A ServerStadium VM or dedicated server (VM Pricing, Dedicated Servers). Basic knowledge of web application development and&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/using-graphql-for-efficient-data-retrieval-on-web-applications/">Using GraphQL for Efficient Data Retrieval on Web Applications</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Introduction</h3>
<p>GraphQL&#8217;s flexibility and efficiency in data retrieval make it a superior choice for modern web applications. Deploying GraphQL on ServerStadium’s infrastructure (<a href="https://serverstadium.com/pricing/" target="_new" rel="noopener">VM Pricing</a>, <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noopener">Dedicated Servers</a>) ensures scalable and optimized data handling capabilities for your web services.</p>
<h3>Prerequisites</h3>
<ul>
<li>A ServerStadium VM or dedicated server (<a href="https://serverstadium.com/pricing/" target="_new" rel="noopener">VM Pricing</a>, <a href="https://serverstadium.com/dedicated-server/" target="_new" rel="noopener">Dedicated Servers</a>).</li>
<li>Basic knowledge of web application development and APIs.</li>
<li>Node.js and NPM installed on the server.</li>
</ul>
<h3>Step 1: Set Up Your ServerStadium Environment</h3>
<ol>
<li><strong>Choose a Server</strong>: Opt for a ServerStadium server that meets your application&#8217;s performance and scalability needs.</li>
<li><strong>Server Setup</strong>:
<div class="shortcode-code">
<p> sudo apt update<br />
sudo apt upgrade </p></div></li>
</ol>
<h3>Step 2: Install and Set Up GraphQL</h3>
<ol>
<li><strong>Initialize a Node.js Project</strong>:
<p>Create a new directory for your project and initialize it with npm:</p>
<div class="shortcode-code">
<p> mkdir my-graphql-project cd my-graphql-project npm init -y </p></div></li>
<li><strong>Install GraphQL Libraries</strong>:
<p>Install <code>graphql</code> and <code>express-graphql</code>, a simple express middleware:</p>
<div class="shortcode-code">
<p> npm install graphql express express-graphql </p></div></li>
</ol>
<h3>Step 3: Implementing GraphQL Schema</h3>
<ol>
<li><strong>Create a GraphQL Schema</strong>:
<p>Define a schema with types and queries in a new file, e.g., <code>schema.js</code>:</p>
<div class="shortcode-code">
<p> const { GraphQLObjectType, GraphQLString, GraphQLSchema } = require(&#039;graphql&#039;);</p>
<p>// Define the Query Type const QueryType = new GraphQLObjectType({ name: &#039;Query&#039;, fields: { hello: { type: GraphQLString, resolve: () =&gt; &#039;Hello, World!&#039; } } });</p>
<p>module.exports = new GraphQLSchema({ query: QueryType }); </p></div></li>
</ol>
<h3>Step 4: Set Up a GraphQL Server</h3>
<ol>
<li><strong>Create a Server File</strong>:
<p>In your project directory, create a file, e.g., <code>server.js</code>, and set up an express server with GraphQL:</p>
<div class="shortcode-code">
<p> const express = require(&#039;express&#039;); const { graphqlHTTP } = require(&#039;express-graphql&#039;); const schema = require(&#039;./schema&#039;);</p>
<p>const app = express();</p>
<p>app.use(&#039;/graphql&#039;, graphqlHTTP({ schema: schema, graphiql: true, // Enables the GraphiQL IDE }));</p>
<p>app.listen(4000); console.log(&#039;Running a GraphQL API server at http://localhost:4000/graphql&#039;); </p></div></li>
</ol>
<h3>Step 5: Running and Testing the GraphQL Server</h3>
<ol>
<li><strong>Start the Server</strong>:
<p>Run your server:</p>
<div class="shortcode-code">
<p> node server.js </p></div></li>
<li><strong>Test GraphQL Queries</strong>:
<p>Open <code>http://localhost:4000/graphql</code> in a browser and test queries using GraphiQL.</li>
</ol>
<h3>Conclusion</h3>
<p>Using GraphQL on your ServerStadium server enhances the data retrieval capabilities of your web applications, providing efficient and tailored responses to client requests. For more advanced GraphQL implementations, consider adding authentication, complex schemas, and database integrations. For further assistance, visit our <a href="https://serverstadium.com/knowledge-base/" target="_new" rel="noopener">knowledge base</a> or contact our support team.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/using-graphql-for-efficient-data-retrieval-on-web-applications/">Using GraphQL for Efficient Data Retrieval on Web Applications</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Generating an API Token</title>
		<link>https://serverstadium.com/knowledge-base/generate-an-api-token/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Tue, 25 Aug 2020 13:48:47 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=153</guid>

					<description><![CDATA[<p>API token is useful to enable access to ServerStadium API located in the API documentation. You can generate such token once you have generated an API key via this guidelines Generate API Key. Please follow the steps below. In our API Documentation, you need to send an authentication to the API gateway. This is to&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/generate-an-api-token/">Generating an API Token</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">API token is useful to enable access to ServerStadium API located in the API documentation. You can generate such token once you have generated an API key via this guidelines <a href="https://serverstadium.com/knowledge-base/generating-api-key/" target="_blank" rel="noreferrer noopener">Generate API Key</a>.</p>



<p class="wp-block-paragraph">Please follow the steps below.</p>



<figure class="wp-block-image"><img decoding="async" src="https://serverstadium.com/wp-content/uploads/2020/09/serverstadium-api-token-generate.png" alt="" class="wp-image-367"/></figure>



<p class="wp-block-paragraph">In our <a href="https://cp.serverstadium.com/apidoc" target="_blank" rel="noreferrer noopener">API Documentation</a>, you need to send an authentication to the API gateway. This is to get your API token, in this case a &#8220;Bearer&#8221; Token.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Step 1</strong>: <strong>Sending a http post</strong></h2>



<p class="wp-block-paragraph">Send a http POST to the URL<code><span class="has-inline-color has-vivid-cyan-blue-color"> https://api.serverstadium.com/v1/api/gateway/user/auth</span></code>  with a raw JSON Body that contains the <span class="has-inline-color has-vivid-cyan-blue-color">app_key</span> and <span class="has-inline-color has-vivid-cyan-blue-color">secret_key</span> found in API Gateway Management Page in the ServerStadium Control Panel. The example raw JSON body is as follow.</p>



<pre class="wp-block-code"><code>{
    "app_key": "9a0bb2f3-4e2e-4e57-b340-ee36f3076515",
    "secret_key": "QLap0OqzMpRccfeDzAnSD8wqj4FPMlda"
}</code></pre>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Step 2</strong>: <strong>Obtaining a bearer token</strong></h2>



<p class="wp-block-paragraph">The API Gateway will return a &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">bearer_token</span>&#8221; that you can use to communicate with the API gateway. The figure below illustrates the response that you will get regarding the bearer token.</p>



<pre class="wp-block-code"><code>{
    "code": 200,
    "data": {
        "bearer_token": "eyJpdiI6IkhldHRZY0FoZjVaSXdYTEdp.....",
        "username": "the_username",
        "expired_at": "2020-08-20 14:43:27",
        "timezone": "UTC",
        "refresh_token": "eyJpdiI6InhFVVY4QmR2YlFF......."
    },
    "message": "success"
}</code></pre>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading"><strong>Step 3</strong>: <strong>Using the bearer token</strong></h2>



<p class="wp-block-paragraph">You may use the &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">bearer_token</span>&#8221; in your header as an &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">Authorization</span>&#8221; with value &#8220;<span class="has-inline-color has-vivid-cyan-blue-color">Bearer &lt;token&gt;</span>&#8221; without the &#8220;&lt;&#8221; or &#8220;&gt;&#8221;</p>



<p class="wp-block-paragraph"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color">Remember</mark>, the token can expire. However, you can use the refresh token to get a new token. That way, you do not need to send another authentication to obtain a new token.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/generate-an-api-token/">Generating an API Token</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Generating an API key</title>
		<link>https://serverstadium.com/knowledge-base/generating-an-api-key/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Tue, 25 Aug 2020 13:32:37 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=141</guid>

					<description><![CDATA[<p>One of the most powerful features in ServerStadium Cloud is API which can automate your deployment in the cloud. However, before using the API, you need to enable and generate an API key for your application or platform. Please follow the steps below: Once you log into the control panel https://cp.serverstadium.com, on the left of&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/generating-an-api-key/">Generating an API key</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">One of the most powerful features in ServerStadium Cloud is API which can automate your deployment in the cloud. However, before using the API, you need to enable and generate an API key for your application or platform. Please follow the steps below:</p>



<p class="wp-block-paragraph">Once you log into the control panel <a href="https://cp.serverstadium.com" target="_blank" rel="noreferrer noopener">https://cp.serverstadium.com</a>, on the left of the dashboard there is a menu, you can click on &#8220;Settings&#8221; and it will redirect you to the Settings Page.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 1</h2>



<p class="wp-block-paragraph">Please click on the blue button &#8220;Add API Gateway&#8221;</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="829" height="478" class="wp-image-142" src="https://serverstadium.com/wp-content/uploads/2020/08/image-7.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/08/image-7.png 829w, https://serverstadium.com/wp-content/uploads/2020/08/image-7-300x173.png 300w, https://serverstadium.com/wp-content/uploads/2020/08/image-7-768x443.png 768w" sizes="(max-width: 829px) 100vw, 829px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 2</h2>



<p class="wp-block-paragraph">You can give it a name for the API, (alphanumeric and dash only)</p>



<figure class="wp-block-image size-large"><img decoding="async" width="511" height="371" class="wp-image-143" src="https://serverstadium.com/wp-content/uploads/2020/08/image-8.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/08/image-8.png 511w, https://serverstadium.com/wp-content/uploads/2020/08/image-8-300x218.png 300w" sizes="(max-width: 511px) 100vw, 511px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 3</h2>



<p class="wp-block-paragraph">You may whitelist the API to allow only certain IP addresses. Then please go ahead and click the blue button &#8220;Add API Gateway&#8221;</p>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 4</h2>



<p class="wp-block-paragraph">You will be redirected back to the Settings Page, and this time, the API Gateway Management will list the new API key that you just added. Click on the <img decoding="async" width="33" height="32" class="wp-image-146" style="width: 33px;" src="https://serverstadium.com/wp-content/uploads/2020/08/plus-sign.png" alt="" /> to view the &#8220;Secret Key&#8221; and additional detailed information.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="816" height="290" class="wp-image-144" src="https://serverstadium.com/wp-content/uploads/2020/08/image-9.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/08/image-9.png 816w, https://serverstadium.com/wp-content/uploads/2020/08/image-9-300x107.png 300w, https://serverstadium.com/wp-content/uploads/2020/08/image-9-768x273.png 768w" sizes="(max-width: 816px) 100vw, 816px" /></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="543" height="261" class="wp-image-147" src="https://serverstadium.com/wp-content/uploads/2020/08/image-11.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/08/image-11.png 543w, https://serverstadium.com/wp-content/uploads/2020/08/image-11-300x144.png 300w" sizes="(max-width: 543px) 100vw, 543px" /></figure>



<h2 class="has-vivid-cyan-blue-color has-text-color wp-block-heading">Step 5</h2>



<p class="wp-block-paragraph">Now you have all the necessary information to start using the API on ServerStadium Cloud.</p>



<p class="wp-block-paragraph">You may continue on this <a href="https://serverstadium.com/knowledge-base/generate-an-api-token/" target="_blank" rel="noreferrer noopener">Generate a Token</a> guideline on how to generate tokens and access the API in ServerStadium Cloud.</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/generating-an-api-key/">Generating an API key</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Deploying a Virtual Machine in ServerStadium</title>
		<link>https://serverstadium.com/knowledge-base/deploying-a-virtual-machine-in-serverstadium/</link>
		
		<dc:creator><![CDATA[Brian K]]></dc:creator>
		<pubDate>Tue, 25 Aug 2020 13:32:21 +0000</pubDate>
				<guid isPermaLink="false">https://cloudraya.com/knowledge-base/?p=125</guid>

					<description><![CDATA[<p>Introduction Deploying a virtual machine in ServerStadium Cloud is very simple. Please follow the steps below. Via Control Panel Once you are logged into the control panel https://cp.serverstadium.com, on the left of the dashboard, there is a menu, and you can click on the &#8220;Add VM&#8221; button You will be presented with an installation wizard:&#8230;</p>
<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-a-virtual-machine-in-serverstadium/">Deploying a Virtual Machine in ServerStadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="has-vivid-cyan-blue-color has-text-color has-large-font-size wp-block-heading">Introduction</h2>



<p class="wp-block-paragraph">Deploying a virtual machine in ServerStadium Cloud is very simple. Please follow the steps below.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color has-large-font-size wp-block-heading">Via Control Panel</h2>



<p class="wp-block-paragraph">Once you are logged into the control panel <a href="https://cp.serverstadium.com">https://cp.serverstadium.com</a>, on the left of the dashboard, there is a menu, and you can click on the &#8220;Add VM&#8221; button</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="114" height="45" class="wp-image-129" src="https://serverstadium.com/wp-content/uploads/2020/08/image.png" alt="" /></figure>
</div>


<p class="wp-block-paragraph">You will be presented with an installation wizard:</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" class="wp-image-130" src="https://serverstadium.com/wp-content/uploads/2020/08/image-1.png" alt="" width="640" height="260" srcset="https://serverstadium.com/wp-content/uploads/2020/08/image-1.png 785w, https://serverstadium.com/wp-content/uploads/2020/08/image-1-300x122.png 300w, https://serverstadium.com/wp-content/uploads/2020/08/image-1-768x313.png 768w" sizes="(max-width: 640px) 100vw, 640px" /></figure>



<p class="wp-block-paragraph"><strong>Step 1</strong>: Select the Location</p>



<p class="wp-block-paragraph"><strong>Step 2</strong>: Enter the Hostname of your choice; only support alphanumeric and dash (&#8220;-&#8220;).</p>



<p class="wp-block-paragraph"><strong>Step 3</strong>: Assign a Security Profile, by default, there is a &#8220;Default&#8221; Security profile that allows management ports such as 22 (ssh), 3389 (rdp), and some service ports such as 80 (http) and 443 (https).</p>



<p class="wp-block-paragraph"><strong>Step 4</strong>: Please select the &#8220;Image&#8221; or the operating system of your choice. Then click the blue &#8220;Step 2&#8221; button on the Add VM page.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="99" height="52" class="wp-image-132" src="https://serverstadium.com/wp-content/uploads/2020/08/image-3.png" alt="" /></figure>
</div>


<p class="wp-block-paragraph"><strong>Step 5</strong>: Select your desired package or a custom package. Then you may click on the blue button &#8220;Step 3&#8221; to review the summary.</p>



<p class="wp-block-paragraph"><strong>Step 6</strong>: Once you have reviewed the summary, you may choose to instantly build the VM or schedule a time for the VM to be built. Then click on the blue button &#8220;Create VM&#8221;</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="370" height="142" class="wp-image-136" src="https://serverstadium.com/wp-content/uploads/2020/08/image-6.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/08/image-6.png 370w, https://serverstadium.com/wp-content/uploads/2020/08/image-6-300x115.png 300w" sizes="(max-width: 370px) 100vw, 370px" />
<figcaption>Instantly Build a VM</figcaption>
</figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="417" height="130" class="wp-image-135" src="https://serverstadium.com/wp-content/uploads/2020/08/image-5.png" alt="" srcset="https://serverstadium.com/wp-content/uploads/2020/08/image-5.png 417w, https://serverstadium.com/wp-content/uploads/2020/08/image-5-300x94.png 300w" sizes="(max-width: 417px) 100vw, 417px" />
<figcaption>Schedule a Build</figcaption>
</figure>



<p class="wp-block-paragraph">You will be directed to the VM detail page showing the provisioning status.</p>



<h2 class="has-vivid-cyan-blue-color has-text-color has-large-font-size wp-block-heading">Via API</h2>



<p class="wp-block-paragraph">You may need to automate a VM build from your own platform. In this case, you may use our robust and simple API to build the VM.</p>



<p class="wp-block-paragraph"><strong>Step 1</strong>: You need to create an API key; please follow this guideline: <a href="https://serverstadium.com/knowledge-base/generating-api-key/" target="_blank" rel="noreferrer noopener">Generating API Key</a></p>



<p class="wp-block-paragraph"><strong>Step 2</strong>: You will need the following items:</p>



<ol class="wp-block-list">
<li>&#8220;Location name&#8221; &#8211; by calling the following API<br /><code>https://api.serverstadium.com/v1/api/gateway/user/location-group-by-country</code></li>
<li>&#8220;Package ID&#8221; &#8211; by calling the following API<br /><code>https://api.serverstadium.com/v1/api/gateway/user/packages/list</code></li>
<li>&#8220;Security Profile ID&#8221; &#8211; by calling the following API<br /><code>https://api.serverstadium.com/v1/api/gateway/user/securityprofiles</code></li>
<li>&#8220;Storage ID&#8221; &#8211; by calling the following API<br /><code>https://api.serverstadium.com/v1/api/gateway/user/storagetype/list</code></li>
<li>&#8220;Template ID&#8221; (the operating system) &#8211; by calling the following API<br /><code>https://api.serverstadium.com/v1/api/gateway/user/templates/list</code></li>
</ol>



<p class="wp-block-paragraph"><strong>Step 3</strong>: By compiling all of the above items into one raw JSON format body, the example as follows:</p>



<pre class="wp-block-code"><code>{
    "location": "Jakarta",
    "package_id": 1,
    "hostname": "test-web02",
    "security_profile": 13,
    "public_ip_id": "automatic",
    "disk_id": 17,
    "schedule_type": "instant",
    "schedule_date": "25-07-2020",
    "schedule_time": "",
    "template_id": "d2efd681-ff1d-40d2-aa3d-90777225119b"
}</code></pre>



<p class="wp-block-paragraph">You will receive a response with your new VM id.</p>



<p class="wp-block-paragraph">You may view additional API information found at <a href="https://cp.serverstadium.com/apidoc" target="_blank" rel="noreferrer noopener">https://cp.serverstadium.com/apidoc</a></p>
<p>The post <a href="https://serverstadium.com/knowledge-base/deploying-a-virtual-machine-in-serverstadium/">Deploying a Virtual Machine in ServerStadium</a> appeared first on <a href="https://serverstadium.com">ServerStadium</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
