Android Question Help to build an HTTP post

Discussion in 'Android Questions' started by marcick, Aug 1, 2019.

  1. marcick

    marcick Well-Known Member Licensed User

    This websyte provide coordinates of a GSM cell, making an HTTP post and passing cell data Mcc, Mnc, Lac and CI.

    I have some sintax difficulties writing the code ....
    These are instructions:

    Code:
    curl --request POST \
      --url https://us1.unwiredlabs.com/v2/process.php \
      --data 
    '{"token": "your_API_token","radio": "gsm","mcc": 310,"mnc": 410,"cells": [{"lac": 7033,"cid": 17811}],"wifi": [{"bssid": "00:17:c5:cd:ca:aa","channel": 11,"frequency": 2412,"signal": -51}, {"bssid": "d8:97:ba:c2:f0:5a"}],"address": 1}'
    Any help is appreciated ....
     
  2. MarkusR

    MarkusR Well-Known Member Licensed User

    Last edited: Aug 1, 2019
  3. DonManfred

    DonManfred Expert Licensed User

    something like

    Code:
    Dim j As HttpJob
        j.Initialize(
    "",Me)
        
    Dim values As Map
        values.Initialize
        values.Put(
    "token",AccessToken)
        values.Put(
    "radio","GSM")
        values.Put(
    "mcc",310)
        values.Put(
    "mnc",410)
       
        
    Dim cells As List
        cells.Initialize
        cells.Add(CreateMap(
    "lac"7033"cid"17811))
       
        values.Put(
    "cells",cells)
       
        
    Dim wifi As List
        wifi.Initialize
        wifi.Add(CreateMap(
    "bssid""00:17:c5:cd:ca:aa","channel"11,"frequency"2412,"signal": -51))
        wifi.Add(CreateMap(
    "bssid""d8:97:ba:c2:f0:5a"))
       
        values.Put(
    "wifi",wifi)
        values.Put(
    "address",1)

        j.PostMultipart(
    "https://us1.unwiredlabs.com/v2/process.php",values,Null)
        
    wait for (j) JobDone(job As HttpJob)
        
    If job.Success Then
            
    Dim response As String = job.GetString
            
    Log(response)      
        
    Else
            
    Log(job.ErrorMessage)
        
    End If
    Maybe @MarkusR is right and you need to build a json and then use job.Poststring(...)
     
    Erel, José J. Aguilar and marcick like this.
  4. marcick

    marcick Well-Known Member Licensed User

    Wonderful !
    Yes, need to build the JSON string, works perfect
    Thanks, thanks, thanks ....
     
    MarkusR likes this.
  5. MarkusR

    MarkusR Well-Known Member Licensed User

    marcick and José J. Aguilar like 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