Use Zennoposter to call an API like with CURL PHP

cherubin

Client
Регистрация
06.06.2016
Сообщения
92
Благодарностей
6
Баллы
8
Hi guys,

I would like to know how i could use zennoposter to call an API which works with curl.
I am not a webdevelopper, so i must be a newbie question...

I think the HTTP option, POST & GET could be helpfull but how do that ?

Here it's the documentation :

/api/guide
POST - launch an order

Parameters
KEY => API key (need to be send through header)
query => the request to generate the order
type => premium / oneshot
lang => fr_fr, en_us, en_gb, es_es, fr_ch, it_it,de_de

Returned Values :

{
"status": "ok",
"query": "string",
"guide_id": "integer",
"type": "string (premium / oneshot)",
}

Код:
curl -X POST -d "query=la%20classe%20americaine&lang=fr_fr&type=premium" -H "KEY: \$2y\$10\$uLE.3XEiAaTbLDNw2GcsluhtkFf68jX5j6HFbfkJaCYvWYAABkqZm" -H "accept: application/json" https://website.tld/api/guide/

/api/guide/{guide_id}

GET - Get the order

Parameters

KEY => API key (in header)

Returned values

{
"type": "string (premium / oneshost)",
"query": "string",
"locale": "string (language)",
"localeName": "string (language)",
"grammes1": array,
"grammes2": array,
"grammes3": array,
"entities": array
}

Код:
curl -X GET -H "KEY: \$2y\$10\$uLE.3XEiAaTbLDNw2GcsluhtkFf68jX5j6HFbfkJaCYvWYAABkqZm" -H "accept: application/json" https://website.tld/api/guide/ID
with ID sent during the  previous order process
Thank you for the help
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Hi.
Well simple answer is yes You have to use GET/POST requests for that.
But to there is not much a way to help You as only help what can be done is provide You working solution.
But in general You use in url: https://website.tld/api/guide/ and in Data field You have to use parameters like: "query=la%20classe%20americaine&lang=fr_fr&type=premium" I'm sure there is key needed somewhere in this parameters, but can not say more without making it. Data type will be Other and: application/json

Keep digging you are on right path :-)

Cheers
 

cherubin

Client
Регистрация
06.06.2016
Сообщения
92
Благодарностей
6
Баллы
8
Hi,

thank you for your feedback, i think i'm closed to succeed, however i have an issue with the key.
The api respond there is an issue with it, so i believe i put it at the wrong place or in the wrong format but i don't how how to translate correctly the php code to POST zenno module...
 

cherubin

Client
Регистрация
06.06.2016
Сообщения
92
Благодарностей
6
Баллы
8
Hello, i cam back.

I tried again to use an api with Zenno and its POST module.
However i don't succeed to received the data.

Where do i must put info in POST module if i want to translate this curl call :

curl -X GET -H "KEY: \$2y\$10\$Dq4ER1vZEUG54PqGYXghFeWQrpXVUF4QNBWKUfLj./nTfcAPEx9vi" -H "accept: application/json" https://services.com/api/status

Посмотреть вложение 37177

Here what i tried, but i doesnt work. So i tried almost every combination without success...
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)