Create a PetParent
1 min
code examples curl request post \\ \ url https //developer digitail io/api/v1/pet parents \\ \ header 'accept application/json' \\ \ header 'content type application/json' \\ \ data '{ "name" "john", "last name" "doe", "terms and conditions" true }'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var raw = json stringify({ "name" "john", "last name" "doe", "terms and conditions" true }); var requestoptions = { method 'post', headers myheaders, body raw, redirect 'follow' }; fetch("https //developer digitail io/api/v1/pet parents", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //developer digitail io/api/v1/pet parents") https = net http new(url host, url port) https use ssl = true request = net http post new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" request body = json dump({ "name" "john", "last name" "doe", "terms and conditions" true }) response = https request(request) puts response read body import requests import json url = "https //developer digitail io/api/v1/pet parents" payload = json dumps({ "name" "john", "last name" "doe", "terms and conditions" true }) headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("post", url, headers=headers, data=payload) print(response text) responses // successful operation { "data" { "id" 1, "name" "john", "last name" "doe", "email" "john\@example com", "phone" "+19772480544", "secondary phone" "+19772480544", "chatuid" "cjfiem c9hg apzm 23sod", "has app" 1, "has app date" "2020 06 12 15 45 43", "enable chat without app" 1, "created at" "2020 06 12 15 45 43", "updated at" "2020 06 12 15 45 43", "address" "flowers st 300, palo alto, 123456, usa", "address 2" "", "city" "buenos aires", "birthdate" "1990 04 04", "observations" "happy", "cnp" "1234567890123", "chip number" "99281028", "discounts" \[ { "id" 10, "name" "digitail disc10", "description" "digitail disc10", "discount" 10, "discount type" 0, "apply on cogs" false, "discount products" 10, "discount type products" 0, "discount services" 10, "discount type services" 0, "enabled" true } ], "address meta data" { "zip code" "123456", "city" "palo alto", "street" "flowers st ", "street number" "1990", "region" "california", "region short code" "ca", "country id" 6, "latitude" "37 4419", "longitude" "122 1430", "address 2" "" }, "current client id" 30, "clients" \[ { "id" 1, "clinic id" 1, "referral source type" "", "referral source details" "" } ], "preferences" {} } }// the request was invalid or contained data that was not allowed { "message" "requested filter(s) `filter1` are not allowed allowed filter(s) are date, query, " }// the authorization token is missing or invalid // the user is not authorized to perform the requested operation // this response is sent when a request fails validation the format is identical on all endpoints { "message" "the name field is required (and 1 more error)", "errors" { "field1" \[ "" ], "field2" \[ "" ] } }// the user has sent too many requests in a given amount of time ("rate limiting") max 200 requests per minute