1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

B4J Question CURL Requests

Discussion in 'B4J Questions' started by icakinser, Apr 13, 2019.

  1. icakinser

    icakinser Member Licensed User

    How would I program this?

    curl -X GET \
    -H "API-KEY-ID: {YOUR_API_KEY_ID}" \
    -H "API-SECRET-KEY: {YOUR_API_SECRET_KEY}"\
    https://{apiserver_domain}/v1/account

    I am not very familiar with how to do curl requests
     
  2. DonManfred

    DonManfred Expert Licensed User

    Something like

    Code:
    Dim Job As HttpJob
        Job.Initialize(
    "UpDateProduction", Me)
        Job.Download(
    "https://{apiserver_domain}/v1/account")
        Job.GetRequest.SetHeader(
    "User-Agent""Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0")
        Job.GetRequest.SetHeader(
    "API-KEY-ID","{YOUR_API_KEY_ID}")
        Job.GetRequest.SetHeader(
    "API-SECRET-KEY","{YOUR_API_SECRET_KEY}")
        Job.GetRequest.SetContentType(
    "application/json;charset=UTF-8")
        
    Wait For (Job) JobDone(j As HttpJob)
        
    If j.Success Then
            
    Log(j.GetString)
        
    Else
            
    Log(j.ErrorMessage)
        
    End If
        j.Release
    It depends on okhttputils2 and okhttp
     
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice