API:Authentication (Api)
From HasOffers
Information about making an authenticated API request.
Contents |
Requirements
- In order to use the API, your network must be on the Enterprise pricing plan or a Dedicated solution.
- All requests require an Api Key, which is a randomly generated string unique to your network.
- IP address making request must have been submitted to the white-list for API access.
- Additionally, all requests require your Network ID.
Creating an Api Key
- Api Keys can be created from within the application:
- Hover over the Support tab in the Navigation Bar and click on the API link from the drop-down.
- If you don't already have an Api Key there will be a notice underneath the Navigation Bar with a link to create one.
- Once you've created one, the page will display your private Api Key. It will begin with the letters 'NET'.
- You can also talk to your Account Manager about creating and obtaining your Api Key
While-list IP Address
- White-listing an IP address can be added from within the application:
- Hover over the Support tab in the Navigation Bar and click on the API link from the drop-down.
- There will be a box underneath your API Key to submit an IP address to whitelist.
- Additional IP addresses can be added to the while-list using Application:WhitelistNetworkApiIp
Making a Request
Your Network's Api Key and Network ID are used to authenticate requests through the API. Every API request must have a valid Api Key and Network ID combination. When making an API Request, use your Api Key value for the NetworkToken parameter, and your Network ID for the NetworkId parameter.
Usage Example
- Network ID is 'demo'
- Api Key is 'NETnH2gyeeRFvfuNg7goLMjoBlwhUY'
- Request is Application:ValidNetworkApiKey
<?php $base = 'https://api.hasoffers.com/Api?'; $params = array( 'Format' => 'json' ,'Target' => 'Application' ,'Method' => 'validNetworkApiKey' ,'Service' => 'HasOffers' ,'Version' => 2 ,'NetworkId' => 'demo' ,'NetworkToken' => 'NETnH2gyeeRFvfuNg7goLMjoBlwhUY' ,'api_key' => 'NETnH2gyeeRFvfuNg7goLMjoBlwhUY' ); $url = $base . http_build_query( $params ); $result = file_get_contents( $url ); echo '<pre>'; print_r( json_decode( $result ) ); echo '</pre>'; ?>
Support Questions
- How to auto login user to hosted application?
- What does the error User not permitted to perform this action?
Email this page to a friend or co-worker