Jump to content

get reqest and curl reverse syntax


faustf
 Share

Recommended Posts

hi guys  , i would  code  a api in autoit  ,  for portal octopart.com,   https://octopart.com/api/docs/v3/search-tutorial

but i have  some questions , in curl  i have  this  syntax

$ curl -G http://octopart.com/api/v3/parts/search \
   -d q=SN74S7* \
   -d apikey=REPLACE_ME \
   -d pretty_print=true

but  how  can use  inside  the browser ?

i tryed in this mode but answer me is not  correct

http://octopart.com/api/v3/parts/search&q=SN74S7&apikey=XXXXXXXXXXXXXXXXXXX


__class__   "ClientErrorResponse"
message "Missing required url argument: 'apikey'"

and how  is possible  to do  in autoit request ??

i try  to  do somthing like  this  but i am not  sure if  i am in a  good  way

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.5
 Author:         faustf

 Script Function:
    Octopart API

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

Global $sGQuery= "solid state relay"

Func _SearchRequestAPI()
    Local $sLOctopartUrlBase ="http://octopart.com/api/v3"
    Local $sLoctopartUrlEndpoint = "/parts/search"
    Local $sLapiKey  = "xxxxxxxxxxxxxxxx"
    
    
EndFunc


Func HttpGet($sURL, $sData = "")
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")

$oHTTP.Open("GET", $sURL & "?" & $sData, False)
If (@error) Then Return SetError(1, 0, 0)

$oHTTP.Send()
If (@error) Then Return SetError(2, 0, 0)

If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0)

Return SetError(0, 0, $oHTTP.ResponseText)
EndFunc

someone can help  me  :) thankz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...