2021年5月4日星期二

API gives 406 code with Accept application/json request

This is the result I get when I try to validate my API.

Content-Type: application/json Vary: Accept

{ "valid": false, "token_uri": "https://mining4btc.com/NFT/rinkeby/CKE/1", "errors": [ "InvalidTokenUrlResponseException: Invalid response, expected 200 but got 406 for URL: https://mining4btc.com/NFT/rinkeby/CKE/1" ] }

I'm using this to validate my API: https://testnets-api.opensea.io/asset/0xe8dD349E3B0F0FA0eE063a2D99541155aFEf14B9/1/validate/

As you can see, it's getting a 406 code.

This is the API:

<?php  header('Content-Type: application/json');    $output = '{    "attributes": [      {        "trait_type": "Eyes",         "value": "cute"      },       {        "trait_type": "Nose",         "value": "cute"      },       {        "trait_type": "Cheeks",         "value": "cute"      },       {        "trait_type": "Toes",         "value": "cute"      },       {        "trait_type": "Ability",         "value": "chairs"      },       {        "display_type": "boost_number",         "trait_type": "Cuteness",         "value": 5000      },       {        "display_type": "number",         "trait_type": "Age",         "value": 1      }    ],     "description": "Thinking about my Mommy.",     "external_url": "https://mining4btc.com/NFT/rinkeby/CKE/external",     "image": "https://mining4btc.com/NFT/rinkeby/CKE/proof/1.jpg",     "name": "Chillin"  }';    $decoded = json_decode($output);  echo json_encode($decoded);    ?>  

This is the .htaccess file

Options +FollowSymLinks  RewriteEngine On    RewriteCond %{SCRIPT_FILENAME} !-d  RewriteCond %{SCRIPT_FILENAME} !-f    RewriteRule ^1$ ./1.php  RewriteRule ^2$ ./2.php  RewriteRule ^contract$ ./CKEcontract.json  RewriteRule ^image$ ./image.jpg  RewriteRule ^external$ ./external.html  
https://stackoverflow.com/questions/67394866/api-gives-406-code-with-accept-application-json-request May 05, 2021 at 11:34AM

没有评论:

发表评论