WordsAPI

FREEMIUM
Verified
โœ“
By dpventures | Updated 13 days ago | Data
Popularity

9.9 / 10

Latency

192ms

Service Level

100%

Health Check

N/A

Back to All Discussions

how to use the mashape api ( with wordsapi ) in production environment?

Rapid account: Toniweb
toniweb
7 years ago

Hi there,

I have a mashape api with wordsapi,

In localhost, it works great;

The problem is that when I try to use the code in production environment I get this response from any request API:

object(Unirest\Response)#2 (4) {
[โ€œcodeโ€]=>
int(401)
[โ€œraw_bodyโ€]=>
bool(false)
[โ€œbodyโ€]=>
NULL
[โ€œheadersโ€]=>
array(1) {
["{โ€œmessageโ€"]=>
string(123) โ€œโ€œMissing Mashape application key. Go to http://docs.mashape.com/api-keys to learn how to get your API application key.โ€}โ€
}
}`

It doesnโ€™t matter if I use the testing or the production keyโ€ฆ

Can you give me a hint?

I am using php and this is my code:

`response=Unirest\Request::get("https://wordsapiv1.p.mashape.com/words/runโ€ฒ),array("Xโˆ’Mashapeโˆ’Key"=>"OpOZ1vYIn7msxxxxxxxxxxxxxxxxxxxxxxxx8GjsnrcGXjUzseBWp","Accept"=>"application/json"));response = Unirest\Request::get("https://wordsapiv1.p.mashape.com/words/run'), array( "X-Mashape-Key" => "OpOZ1vYIn7msxxxxxxxxxxxxxxxxxxxxxxxx8GjsnrcGXjUzseBWp", "Accept" => "application/json" ) ); raw_body = json_decode($response->raw_body);

Best regards!

thansk in advance

Rapid account: Toniweb
toniweb Commented 7 years ago

Since in local environment the request works, i can only assume itโ€™s setted up correctlyโ€ฆ

Rapid account: Wordsapi
wordsapi Commented 7 years ago

Hi,
There shouldnโ€™t be any difference where you call the API from. Make sure that the mashape key is being loaded correctly. If it is, you may want to reach out to Mashape, since it looks like the request is being blocked by them and never even making it to Words API.

Join in the discussion - add comment below:

Login / Signup to post new comments