Ho creato un token API utilizzando l’API; la mia risposta dopo il reindirizzamento di autenticazione assomiglia a questa:
{
api = 4;
key = bd0553a26566b6ace74869ad6042fc22;
nonce = “5A3D2DD2-D6E3-4539-BDE1-3F114B9EC3A1”;
push = 0;
}
Successivamente provo a creare un nuovo post utilizzando l’API nel seguente modo:
---RICHIESTA------------------
URL: https://myserver.com/posts.json
METODO: POST
Api-Key: bd0553a26566b6ace74869ad6042fc22
Content-Type: application/json
Api-Username: AndrewB
BODY: {
"title" : "Test topic",
"raw" : "This is posted from the API",
"category" : 0
}
----------------------------
Ma ricevo un errore di accesso non valido:
---RISPOSTA------------------
URL: https://myserver.com/posts.json
MIMEType: application/json
Codice di stato: 403
Content-Type: application/json; charset=utf-8
x-runtime: 0.006244
Content-Encoding: gzip
Server: nginx
x-download-options: noopen
x-xss-protection: 1; mode=block
x-permitted-cross-domain-policies: none
referrer-policy: strict-origin-when-cross-origin
Data: Tue, 31 Mar 2020 17:37:54 GMT
x-request-id: 82b293d8-a609-42b1-8338-dcbdcbc72a61
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
Vary: Accept-Encoding
Dati di risposta: {"errors":["You are not permitted to view the requested resource. The API username or key is invalid."],"error_type":"invalid_access"}
JSON di risposta: {
"error_type" = "invalid_access";
errors = (
"You are not permitted to view the requested resource. The API username or key is invalid."
);
}
----------------------------
L’account utente appare così:
Sezione API degli amministratori:
Sto trascurando qualcosa di ovvio? Qualsiasi aiuto è apprezzato!

