Upsert endpoint parameters - Need syntax example

Looking at the docs for the Upsert endpoint parameters, I don’t see any example of the syntax for using these. Can someone please tell me where an example of using these would be?

  • ack
  • new_vertex_only
  • vertex_must_exist

Thank you.

URL sample:
http://localhost:9000/graph/MyGraph?ack=all&new_vertex_only=true&vertex_must_exist=true

Notice the params added.

This endpoint accepts three parameters:

name data type default description
ack string, can only be “all” or “none” “all” " all ": request will return after all GPE instances have acknowledged the POST " none ": request will return immediately after RESTPP processed the POST.
new_vertex_only bool false " false ": Upsert vertices " true ": Treat vertices as insert-only. If the input data refers to a vertex which already exists, do not update it.
vertex_must_exist bool false " false ": Always insert new edges. If a new edge refers to an endpoint vertex which does not exist, create the necessary vertices, using given id and default values for other parameters. " true ": Only insert or update an edge If both endpoint vertices already exist.

@gpadvorac does this help a bit?

Code for cURL

curl --location --request POST 'http://localhost:9000/graph/MyGraph?ack=all&new_vertex_only=true&vertex_must_exist=true' \
--header 'Authorization: Bearer 3n5t5h3ahbncdjr0a3apo5jd48prvjd2' \
--header 'Content-Type: application/json' \
--data-raw '{
 "vertices": {
    "Patient": {
      "007": {
      }
    }
  },
  "edges": {
    "Patient":{
      "007": {
        "INFECTED_BY": {
          "Patient": {
            "008" : {
            }
          }
        }
      }
    }
  }
}'
1 Like

Thanks Jon, I was expecting this to be part of the Json being passed in.

Yes , like this - Like all paths where params are passed in as data:

curl -s -X POST 'http://localhost:9000/allpaths' -d
'{
  "sources":[{"type":"Video","id":"0"}],
  "targets":[{"type": "AttributeTag", "id":"action"}],
  "vertexFilters":[{"type":"Video", "condition":"year >= 1984"}],
  "maxLength": 3
}'

Try that way above. Let me see if we can clear up any communication gaps in the documentation.

Hi Jon,

Your first example makes sense it me but I’m confused about the 2nd example because it doesn’t look like an upsert operation.

I can add these 3 parameters into the connector’s API and add them into the URL when applicable. For example, similar to the pyTigerGraph’s upsertVertices function, I’ll add these as 3 additional optional parameters into the function and format the URL there.

I should have figured it out where the docs said “This endpoint accepts three parameters:”

@gpadvoracthe second example is the ALL PATHS endpoint. It’s showing the parameters being passed in the data object. curl -s -X POST 'http://localhost:9000/allpaths' -d